Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid

Pull HID updates from Jiri Kosina:
"Updates for HID code

- improveements of Logitech HID++ procotol implementation, from
Benjamin Tissoires

- support for composite RMI devices, from Andrew Duggan

- new driver for BETOP controller, from Huang Bo

- fixup for conflicting mapping in HID core between PC-101/103/104
and PC-102/105 keyboards from David Herrmann

- new hardware support and fixes in Wacom driver, from Ping Cheng

- assorted small fixes and device ID additions all over the place"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (33 commits)
HID: wacom: add support for Cintiq 27QHD and 27QHD touch
HID: wacom: consolidate input capability settings for pen and touch
HID: wacom: make sure touch arbitration is applied consistently
HID: pidff: Fix initialisation forMicrosoft Sidewinder FF Pro 2
HID: hyperv: match wait_for_completion_timeout return type
HID: wacom: Report ABS_MISC event for Cintiq Companion Hybrid
HID: Use Kbuild idiom in Makefiles
HID: do not bind to Microchip Pick16F1454
HID: hid-lg4ff: use DEVICE_ATTR_RW macro
HID: hid-lg4ff: fix sysfs attribute permission
HID: wacom: peport In Range event according to the spec
HID: wacom: process invalid Cintiq and Intuos data in wacom_intuos_inout()
HID: rmi: Add support for the touchpad in the Razer Blade 14 laptop
HID: rmi: Support touchpads with external buttons
HID: rmi: Use hid_report_len to compute the size of reports
HID: logitech-hidpp: store the name of the device in struct hidpp
HID: microsoft: add support for Japanese Surface Type Cover 3
HID: fixup the conflicting keyboard mappings quirk
HID: apple: fix battery support for the 2009 ANSI wireless keyboard
HID: fix Kconfig text
...

+645 -231
+11 -1
drivers/hid/Kconfig
··· 147 147 ---help--- 148 148 Support for Belkin Flip KVM and Wireless keyboard. 149 149 150 + config HID_BETOP_FF 151 + tristate "Betop Production Inc. force feedback support" 152 + depends on USB_HID 153 + select INPUT_FF_MEMLESS 154 + ---help--- 155 + Say Y here if you want to enable force feedback support for devices by 156 + BETOP Production Ltd. 157 + Currently the following devices are known to be supported: 158 + - BETOP 2185 PC & BFM MODE 159 + 150 160 config HID_CHERRY 151 161 tristate "Cherry Cymotion keyboard" if EXPERT 152 162 depends on HID ··· 399 389 Say Y if you want support for Logitech devices relying on the HID++ 400 390 specification. Such devices are the various Logitech Touchpads (T650, 401 391 T651, TK820), some mice (Zone Touch mouse), or even keyboards (Solar 402 - Keayboard). 392 + Keyboard). 403 393 404 394 config LOGITECH_FF 405 395 bool "Logitech force feedback support"
+13 -37
drivers/hid/Makefile
··· 2 2 # Makefile for the HID driver 3 3 # 4 4 hid-y := hid-core.o hid-input.o 5 - 6 - ifdef CONFIG_DEBUG_FS 7 - hid-objs += hid-debug.o 8 - endif 5 + hid-$(CONFIG_DEBUG_FS) += hid-debug.o 9 6 10 7 obj-$(CONFIG_HID) += hid.o 11 8 obj-$(CONFIG_UHID) += uhid.o ··· 12 15 hid-$(CONFIG_HIDRAW) += hidraw.o 13 16 14 17 hid-logitech-y := hid-lg.o 15 - ifdef CONFIG_LOGITECH_FF 16 - hid-logitech-y += hid-lgff.o 17 - endif 18 - ifdef CONFIG_LOGIRUMBLEPAD2_FF 19 - hid-logitech-y += hid-lg2ff.o 20 - endif 21 - ifdef CONFIG_LOGIG940_FF 22 - hid-logitech-y += hid-lg3ff.o 23 - endif 24 - ifdef CONFIG_LOGIWHEELS_FF 25 - hid-logitech-y += hid-lg4ff.o 26 - endif 18 + hid-logitech-$(CONFIG_LOGITECH_FF) += hid-lgff.o 19 + hid-logitech-$(CONFIG_LOGIRUMBLEPAD2_FF) += hid-lg2ff.o 20 + hid-logitech-$(CONFIG_LOGIG940_FF) += hid-lg3ff.o 21 + hid-logitech-$(CONFIG_LOGIWHEELS_FF) += hid-lg4ff.o 27 22 28 23 hid-wiimote-y := hid-wiimote-core.o hid-wiimote-modules.o 29 - ifdef CONFIG_DEBUG_FS 30 - hid-wiimote-y += hid-wiimote-debug.o 31 - endif 24 + hid-wiimote-$(CONFIG_DEBUG_FS) += hid-wiimote-debug.o 32 25 33 26 obj-$(CONFIG_HID_A4TECH) += hid-a4tech.o 34 27 obj-$(CONFIG_HID_ACRUX) += hid-axff.o ··· 26 39 obj-$(CONFIG_HID_APPLEIR) += hid-appleir.o 27 40 obj-$(CONFIG_HID_AUREAL) += hid-aureal.o 28 41 obj-$(CONFIG_HID_BELKIN) += hid-belkin.o 42 + obj-$(CONFIG_HID_BETOP_FF) += hid-betopff.o 29 43 obj-$(CONFIG_HID_CHERRY) += hid-cherry.o 30 44 obj-$(CONFIG_HID_CHICONY) += hid-chicony.o 31 45 obj-$(CONFIG_HID_CP2112) += hid-cp2112.o ··· 64 76 obj-$(CONFIG_HID_PETALYNX) += hid-petalynx.o 65 77 obj-$(CONFIG_HID_PICOLCD) += hid-picolcd.o 66 78 hid-picolcd-y += hid-picolcd_core.o 67 - ifdef CONFIG_HID_PICOLCD_FB 68 - hid-picolcd-y += hid-picolcd_fb.o 69 - endif 70 - ifdef CONFIG_HID_PICOLCD_BACKLIGHT 71 - hid-picolcd-y += hid-picolcd_backlight.o 72 - endif 73 - ifdef CONFIG_HID_PICOLCD_LCD 74 - hid-picolcd-y += hid-picolcd_lcd.o 75 - endif 76 - ifdef CONFIG_HID_PICOLCD_LEDS 77 - hid-picolcd-y += hid-picolcd_leds.o 78 - endif 79 - ifdef CONFIG_HID_PICOLCD_CIR 80 - hid-picolcd-y += hid-picolcd_cir.o 81 - endif 82 - ifdef CONFIG_DEBUG_FS 83 - hid-picolcd-y += hid-picolcd_debugfs.o 84 - endif 79 + hid-picolcd-$(CONFIG_HID_PICOLCD_FB) += hid-picolcd_fb.o 80 + hid-picolcd-$(CONFIG_HID_PICOLCD_BACKLIGHT) += hid-picolcd_backlight.o 81 + hid-picolcd-$(CONFIG_HID_PICOLCD_LCD) += hid-picolcd_lcd.o 82 + hid-picolcd-$(CONFIG_HID_PICOLCD_LEDS) += hid-picolcd_leds.o 83 + hid-picolcd-$(CONFIG_HID_PICOLCD_CIR) += hid-picolcd_cir.o 84 + hid-picolcd-$(CONFIG_DEBUG_FS) += hid-picolcd_debugfs.o 85 85 86 86 obj-$(CONFIG_HID_PLANTRONICS) += hid-plantronics.o 87 87 obj-$(CONFIG_HID_PRIMAX) += hid-primax.o
+160
drivers/hid/hid-betopff.c
··· 1 + /* 2 + * Force feedback support for Betop based devices 3 + * 4 + * The devices are distributed under various names and the same USB device ID 5 + * can be used in both adapters and actual game controllers. 6 + * 7 + * 0x11c2:0x2208 "BTP2185 BFM mode Joystick" 8 + * - tested with BTP2185 BFM Mode. 9 + * 10 + * 0x11C0:0x5506 "BTP2185 PC mode Joystick" 11 + * - tested with BTP2185 PC Mode. 12 + * 13 + * 0x8380:0x1850 "BTP2185 V2 PC mode USB Gamepad" 14 + * - tested with BTP2185 PC Mode with another version. 15 + * 16 + * 0x20bc:0x5500 "BTP2185 V2 BFM mode Joystick" 17 + * - tested with BTP2171s. 18 + * Copyright (c) 2014 Huang Bo <huangbobupt@163.com> 19 + */ 20 + 21 + /* 22 + * This program is free software; you can redistribute it and/or modify it 23 + * under the terms of the GNU General Public License as published by the Free 24 + * Software Foundation; either version 2 of the License, or (at your option) 25 + * any later version. 26 + */ 27 + 28 + 29 + #include <linux/input.h> 30 + #include <linux/slab.h> 31 + #include <linux/module.h> 32 + #include <linux/hid.h> 33 + 34 + #include "hid-ids.h" 35 + 36 + struct betopff_device { 37 + struct hid_report *report; 38 + }; 39 + 40 + static int hid_betopff_play(struct input_dev *dev, void *data, 41 + struct ff_effect *effect) 42 + { 43 + struct hid_device *hid = input_get_drvdata(dev); 44 + struct betopff_device *betopff = data; 45 + __u16 left, right; 46 + 47 + left = effect->u.rumble.strong_magnitude; 48 + right = effect->u.rumble.weak_magnitude; 49 + 50 + betopff->report->field[2]->value[0] = left / 256; 51 + betopff->report->field[3]->value[0] = right / 256; 52 + 53 + hid_hw_request(hid, betopff->report, HID_REQ_SET_REPORT); 54 + 55 + return 0; 56 + } 57 + 58 + static int betopff_init(struct hid_device *hid) 59 + { 60 + struct betopff_device *betopff; 61 + struct hid_report *report; 62 + struct hid_input *hidinput = 63 + list_first_entry(&hid->inputs, struct hid_input, list); 64 + struct list_head *report_list = 65 + &hid->report_enum[HID_OUTPUT_REPORT].report_list; 66 + struct input_dev *dev = hidinput->input; 67 + int field_count = 0; 68 + int error; 69 + int i, j; 70 + 71 + if (list_empty(report_list)) { 72 + hid_err(hid, "no output reports found\n"); 73 + return -ENODEV; 74 + } 75 + 76 + report = list_first_entry(report_list, struct hid_report, list); 77 + /* 78 + * Actually there are 4 fields for 4 Bytes as below: 79 + * ----------------------------------------- 80 + * Byte0 Byte1 Byte2 Byte3 81 + * 0x00 0x00 left_motor right_motor 82 + * ----------------------------------------- 83 + * Do init them with default value. 84 + */ 85 + for (i = 0; i < report->maxfield; i++) { 86 + for (j = 0; j < report->field[i]->report_count; j++) { 87 + report->field[i]->value[j] = 0x00; 88 + field_count++; 89 + } 90 + } 91 + 92 + if (field_count < 4) { 93 + hid_err(hid, "not enough fields in the report: %d\n", 94 + field_count); 95 + return -ENODEV; 96 + } 97 + 98 + betopff = kzalloc(sizeof(*betopff), GFP_KERNEL); 99 + if (!betopff) 100 + return -ENOMEM; 101 + 102 + set_bit(FF_RUMBLE, dev->ffbit); 103 + 104 + error = input_ff_create_memless(dev, betopff, hid_betopff_play); 105 + if (error) { 106 + kfree(betopff); 107 + return error; 108 + } 109 + 110 + betopff->report = report; 111 + hid_hw_request(hid, betopff->report, HID_REQ_SET_REPORT); 112 + 113 + hid_info(hid, "Force feedback for betop devices by huangbo <huangbobupt@163.com>\n"); 114 + 115 + return 0; 116 + } 117 + 118 + static int betop_probe(struct hid_device *hdev, const struct hid_device_id *id) 119 + { 120 + int ret; 121 + 122 + if (id->driver_data) 123 + hdev->quirks |= HID_QUIRK_MULTI_INPUT; 124 + 125 + ret = hid_parse(hdev); 126 + if (ret) { 127 + hid_err(hdev, "parse failed\n"); 128 + goto err; 129 + } 130 + 131 + ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); 132 + if (ret) { 133 + hid_err(hdev, "hw start failed\n"); 134 + goto err; 135 + } 136 + 137 + betopff_init(hdev); 138 + 139 + return 0; 140 + err: 141 + return ret; 142 + } 143 + 144 + static const struct hid_device_id betop_devices[] = { 145 + { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) }, 146 + { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185PC, 0x5506) }, 147 + { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2PC, 0x1850) }, 148 + { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2BFM, 0x5500) }, 149 + { } 150 + }; 151 + MODULE_DEVICE_TABLE(hid, betop_devices); 152 + 153 + static struct hid_driver betop_driver = { 154 + .name = "betop", 155 + .id_table = betop_devices, 156 + .probe = betop_probe, 157 + }; 158 + module_hid_driver(betop_driver); 159 + 160 + MODULE_LICENSE("GPL");
+26 -6
drivers/hid/hid-core.c
··· 698 698 static void hid_scan_collection(struct hid_parser *parser, unsigned type) 699 699 { 700 700 struct hid_device *hid = parser->device; 701 + int i; 701 702 702 703 if (((parser->global.usage_page << 16) == HID_UP_SENSOR) && 703 704 type == HID_COLLECTION_PHYSICAL) 704 705 hid->group = HID_GROUP_SENSOR_HUB; 705 706 706 707 if (hid->vendor == USB_VENDOR_ID_MICROSOFT && 707 - hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 && 708 + (hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 || 709 + hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3_JP) && 708 710 hid->group == HID_GROUP_MULTITOUCH) 709 711 hid->group = HID_GROUP_GENERIC; 712 + 713 + if ((parser->global.usage_page << 16) == HID_UP_GENDESK) 714 + for (i = 0; i < parser->local.usage_index; i++) 715 + if (parser->local.usage[i] == HID_GD_POINTER) 716 + parser->scan_flags |= HID_SCAN_FLAG_GD_POINTER; 717 + 718 + if ((parser->global.usage_page << 16) >= HID_UP_MSVENDOR) 719 + parser->scan_flags |= HID_SCAN_FLAG_VENDOR_SPECIFIC; 710 720 } 711 721 712 722 static int hid_scan_main(struct hid_parser *parser, struct hid_item *item) ··· 802 792 hid->group = HID_GROUP_WACOM; 803 793 break; 804 794 case USB_VENDOR_ID_SYNAPTICS: 805 - if ((hid->group == HID_GROUP_GENERIC) && 806 - (hid->bus != BUS_USB || hid->type == HID_TYPE_USBMOUSE)) 807 - /* hid-rmi should only bind to the mouse interface of 808 - * composite USB devices */ 809 - hid->group = HID_GROUP_RMI; 795 + if (hid->group == HID_GROUP_GENERIC) 796 + if ((parser->scan_flags & HID_SCAN_FLAG_VENDOR_SPECIFIC) 797 + && (parser->scan_flags & HID_SCAN_FLAG_GD_POINTER)) 798 + /* 799 + * hid-rmi should take care of them, 800 + * not hid-generic 801 + */ 802 + hid->group = HID_GROUP_RMI; 810 803 break; 811 804 } 812 805 ··· 1770 1757 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, 1771 1758 { HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) }, 1772 1759 { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) }, 1760 + { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) }, 1761 + { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185PC, 0x5506) }, 1762 + { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2PC, 0x1850) }, 1763 + { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2BFM, 0x5500) }, 1773 1764 { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) }, 1774 1765 { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) }, 1775 1766 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, ··· 1878 1861 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) }, 1879 1862 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_OFFICE_KB) }, 1880 1863 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3) }, 1864 + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP) }, 1881 1865 { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) }, 1882 1866 { HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL) }, 1883 1867 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) }, ··· 1989 1971 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) }, 1990 1972 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE) }, 1991 1973 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE2) }, 1974 + { HID_USB_DEVICE(USB_VENDOR_ID_RAZER, USB_DEVICE_ID_RAZER_BLADE_14) }, 1992 1975 { } 1993 1976 }; 1994 1977 ··· 2347 2328 { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) }, 2348 2329 { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) }, 2349 2330 { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT2) }, 2331 + { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICK16F1454) }, 2350 2332 { HID_USB_DEVICE(USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR, USB_DEVICE_ID_N_S_HARMONY) }, 2351 2333 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100) }, 2352 2334 { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 20) },
+1 -1
drivers/hid/hid-hyperv.c
··· 381 381 static int mousevsc_connect_to_vsp(struct hv_device *device) 382 382 { 383 383 int ret = 0; 384 - int t; 384 + unsigned long t; 385 385 struct mousevsc_dev *input_dev = hv_get_drvdata(device); 386 386 struct mousevsc_prt_msg *request; 387 387 struct mousevsc_prt_msg *response;
+10
drivers/hid/hid-ids.h
··· 189 189 #define USB_VENDOR_ID_BERKSHIRE 0x0c98 190 190 #define USB_DEVICE_ID_BERKSHIRE_PCWD 0x1140 191 191 192 + #define USB_VENDOR_ID_BETOP_2185BFM 0x11c2 193 + #define USB_VENDOR_ID_BETOP_2185PC 0x11c0 194 + #define USB_VENDOR_ID_BETOP_2185V2PC 0x8380 195 + #define USB_VENDOR_ID_BETOP_2185V2BFM 0x20bc 196 + 192 197 #define USB_VENDOR_ID_BTC 0x046e 193 198 #define USB_DEVICE_ID_BTC_EMPREX_REMOTE 0x5578 194 199 #define USB_DEVICE_ID_BTC_EMPREX_REMOTE_2 0x5577 ··· 643 638 #define USB_DEVICE_ID_PICKIT2 0x0033 644 639 #define USB_DEVICE_ID_PICOLCD 0xc002 645 640 #define USB_DEVICE_ID_PICOLCD_BOOTLOADER 0xf002 641 + #define USB_DEVICE_ID_PICK16F1454 0x0042 646 642 647 643 #define USB_VENDOR_ID_MICROSOFT 0x045e 648 644 #define USB_DEVICE_ID_SIDEWINDER_GV 0x003b ··· 660 654 #define USB_DEVICE_ID_MS_TOUCH_COVER_2 0x07a7 661 655 #define USB_DEVICE_ID_MS_TYPE_COVER_2 0x07a9 662 656 #define USB_DEVICE_ID_MS_TYPE_COVER_3 0x07dc 657 + #define USB_DEVICE_ID_MS_TYPE_COVER_3_JP 0x07dd 663 658 664 659 #define USB_VENDOR_ID_MOJO 0x8282 665 660 #define USB_DEVICE_ID_RETRO_ADAPTER 0x3201 ··· 774 767 #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH 0x3000 775 768 #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001 0x3001 776 769 #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008 0x3008 770 + 771 + #define USB_VENDOR_ID_RAZER 0x1532 772 + #define USB_DEVICE_ID_RAZER_BLADE_14 0x011D 777 773 778 774 #define USB_VENDOR_ID_REALTEK 0x0bda 779 775 #define USB_DEVICE_ID_REALTEK_READER 0x0152
+23 -3
drivers/hid/hid-input.c
··· 306 306 307 307 static const struct hid_device_id hid_battery_quirks[] = { 308 308 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 309 - USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO), 310 - HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, 309 + USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO), 310 + HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, 311 311 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 312 - USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI), 312 + USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), 313 + HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, 314 + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 315 + USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI), 313 316 HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, 314 317 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 315 318 USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO), ··· 1106 1103 dbg_hid("Ignoring out-of-range value %x\n", value); 1107 1104 return; 1108 1105 } 1106 + 1107 + /* 1108 + * Ignore reports for absolute data if the data didn't change. This is 1109 + * not only an optimization but also fixes 'dead' key reports. Some 1110 + * RollOver implementations for localized keys (like BACKSLASH/PIPE; HID 1111 + * 0x31 and 0x32) report multiple keys, even though a localized keyboard 1112 + * can only have one of them physically available. The 'dead' keys 1113 + * report constant 0. As all map to the same keycode, they'd confuse 1114 + * the input layer. If we filter the 'dead' keys on the HID level, we 1115 + * skip the keycode translation and only forward real events. 1116 + */ 1117 + if (!(field->flags & (HID_MAIN_ITEM_RELATIVE | 1118 + HID_MAIN_ITEM_BUFFERED_BYTE)) && 1119 + (field->flags & HID_MAIN_ITEM_VARIABLE) && 1120 + usage->usage_index < field->maxusage && 1121 + value == field->value[usage->usage_index]) 1122 + return; 1109 1123 1110 1124 /* report the usage code as scancode if the key status has changed */ 1111 1125 if (usage->type == EV_KEY && !!test_bit(usage->code, input->key) != value)
+78 -1
drivers/hid/hid-lenovo.c
··· 38 38 39 39 struct lenovo_drvdata_cptkbd { 40 40 bool fn_lock; 41 + int sensitivity; 41 42 }; 42 43 43 44 #define map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, EV_KEY, (c)) ··· 92 91 case 0x00fa: /* Fn-Esc: Fn-lock toggle */ 93 92 map_key_clear(KEY_FN_ESC); 94 93 return 1; 94 + case 0x00fb: /* Middle mouse button (in native mode) */ 95 + map_key_clear(BTN_MIDDLE); 96 + return 1; 97 + } 98 + } 99 + 100 + /* Compatibility middle/wheel mappings should be ignored */ 101 + if (usage->hid == HID_GD_WHEEL) 102 + return -1; 103 + if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON && 104 + (usage->hid & HID_USAGE) == 0x003) 105 + return -1; 106 + if ((usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER && 107 + (usage->hid & HID_USAGE) == 0x238) 108 + return -1; 109 + 110 + /* Map wheel emulation reports: 0xffa1 = USB, 0xff10 = BT */ 111 + if ((usage->hid & HID_USAGE_PAGE) == 0xff100000 || 112 + (usage->hid & HID_USAGE_PAGE) == 0xffa10000) { 113 + field->flags |= HID_MAIN_ITEM_RELATIVE | HID_MAIN_ITEM_VARIABLE; 114 + field->logical_minimum = -127; 115 + field->logical_maximum = 127; 116 + 117 + switch (usage->hid & HID_USAGE) { 118 + case 0x0000: 119 + hid_map_usage(hi, usage, bit, max, EV_REL, 0x06); 120 + return 1; 121 + case 0x0001: 122 + hid_map_usage(hi, usage, bit, max, EV_REL, 0x08); 123 + return 1; 124 + default: 125 + return -1; 95 126 } 96 127 } 97 128 ··· 178 145 struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev); 179 146 180 147 ret = lenovo_send_cmd_cptkbd(hdev, 0x05, cptkbd_data->fn_lock); 148 + ret = lenovo_send_cmd_cptkbd(hdev, 0x02, cptkbd_data->sensitivity); 181 149 if (ret) 182 150 hid_err(hdev, "Fn-lock setting failed: %d\n", ret); 183 151 } ··· 213 179 return count; 214 180 } 215 181 182 + static ssize_t attr_sensitivity_show_cptkbd(struct device *dev, 183 + struct device_attribute *attr, 184 + char *buf) 185 + { 186 + struct hid_device *hdev = container_of(dev, struct hid_device, dev); 187 + struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev); 188 + 189 + return snprintf(buf, PAGE_SIZE, "%u\n", 190 + cptkbd_data->sensitivity); 191 + } 192 + 193 + static ssize_t attr_sensitivity_store_cptkbd(struct device *dev, 194 + struct device_attribute *attr, 195 + const char *buf, 196 + size_t count) 197 + { 198 + struct hid_device *hdev = container_of(dev, struct hid_device, dev); 199 + struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev); 200 + int value; 201 + 202 + if (kstrtoint(buf, 10, &value) || value < 1 || value > 255) 203 + return -EINVAL; 204 + 205 + cptkbd_data->sensitivity = value; 206 + lenovo_features_set_cptkbd(hdev); 207 + 208 + return count; 209 + } 210 + 211 + 216 212 static struct device_attribute dev_attr_fn_lock_cptkbd = 217 213 __ATTR(fn_lock, S_IWUSR | S_IRUGO, 218 214 attr_fn_lock_show_cptkbd, 219 215 attr_fn_lock_store_cptkbd); 220 216 217 + static struct device_attribute dev_attr_sensitivity_cptkbd = 218 + __ATTR(sensitivity, S_IWUSR | S_IRUGO, 219 + attr_sensitivity_show_cptkbd, 220 + attr_sensitivity_store_cptkbd); 221 + 222 + 221 223 static struct attribute *lenovo_attributes_cptkbd[] = { 222 224 &dev_attr_fn_lock_cptkbd.attr, 225 + &dev_attr_sensitivity_cptkbd.attr, 223 226 NULL 224 227 }; 225 228 ··· 665 594 if (ret) 666 595 hid_warn(hdev, "Failed to switch F7/9/11 mode: %d\n", ret); 667 596 668 - /* Turn Fn-Lock on by default */ 597 + /* Switch middle button to native mode */ 598 + ret = lenovo_send_cmd_cptkbd(hdev, 0x09, 0x01); 599 + if (ret) 600 + hid_warn(hdev, "Failed to switch middle button: %d\n", ret); 601 + 602 + /* Set keyboard settings to known state */ 669 603 cptkbd_data->fn_lock = true; 604 + cptkbd_data->sensitivity = 0x05; 670 605 lenovo_features_set_cptkbd(hdev); 671 606 672 607 ret = sysfs_create_group(&hdev->dev.kobj, &lenovo_attr_group_cptkbd);
+5 -6
drivers/hid/hid-lg4ff.c
··· 49 49 50 50 static void hid_lg4ff_set_range_dfp(struct hid_device *hid, u16 range); 51 51 static void hid_lg4ff_set_range_g25(struct hid_device *hid, u16 range); 52 - static ssize_t lg4ff_range_show(struct device *dev, struct device_attribute *attr, char *buf); 53 - static ssize_t lg4ff_range_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); 54 - 55 - static DEVICE_ATTR(range, S_IRWXU | S_IRWXG | S_IROTH, lg4ff_range_show, lg4ff_range_store); 56 52 57 53 struct lg4ff_device_entry { 58 54 __u32 product_id; ··· 412 416 } 413 417 414 418 /* Read current range and display it in terminal */ 415 - static ssize_t lg4ff_range_show(struct device *dev, struct device_attribute *attr, char *buf) 419 + static ssize_t range_show(struct device *dev, struct device_attribute *attr, 420 + char *buf) 416 421 { 417 422 struct hid_device *hid = to_hid_device(dev); 418 423 struct lg4ff_device_entry *entry; ··· 438 441 439 442 /* Set range to user specified value, call appropriate function 440 443 * according to the type of the wheel */ 441 - static ssize_t lg4ff_range_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 444 + static ssize_t range_store(struct device *dev, struct device_attribute *attr, 445 + const char *buf, size_t count) 442 446 { 443 447 struct hid_device *hid = to_hid_device(dev); 444 448 struct lg4ff_device_entry *entry; ··· 470 472 471 473 return count; 472 474 } 475 + static DEVICE_ATTR_RW(range); 473 476 474 477 #ifdef CONFIG_LEDS_CLASS 475 478 static void lg4ff_set_leds(struct hid_device *hid, __u8 leds)
+55 -26
drivers/hid/hid-logitech-hidpp.c
··· 89 89 struct hid_device *hid_dev; 90 90 struct mutex send_mutex; 91 91 void *send_receive_buf; 92 + char *name; /* will never be NULL and should not be freed */ 92 93 wait_queue_head_t wait; 93 94 bool answer_available; 94 95 u8 protocol_major; ··· 106 105 }; 107 106 108 107 108 + /* HID++ 1.0 error codes */ 109 109 #define HIDPP_ERROR 0x8f 110 110 #define HIDPP_ERROR_SUCCESS 0x00 111 111 #define HIDPP_ERROR_INVALID_SUBID 0x01 ··· 121 119 #define HIDPP_ERROR_REQUEST_UNAVAILABLE 0x0a 122 120 #define HIDPP_ERROR_INVALID_PARAM_VALUE 0x0b 123 121 #define HIDPP_ERROR_WRONG_PIN_CODE 0x0c 122 + /* HID++ 2.0 error codes */ 123 + #define HIDPP20_ERROR 0xff 124 124 125 125 static void hidpp_connect_event(struct hidpp_device *hidpp_dev); 126 126 ··· 196 192 } 197 193 198 194 if (response->report_id == REPORT_ID_HIDPP_SHORT && 199 - response->fap.feature_index == HIDPP_ERROR) { 195 + response->rap.sub_id == HIDPP_ERROR) { 196 + ret = response->rap.params[1]; 197 + dbg_hid("%s:got hidpp error %02X\n", __func__, ret); 198 + goto exit; 199 + } 200 + 201 + if (response->report_id == REPORT_ID_HIDPP_LONG && 202 + response->fap.feature_index == HIDPP20_ERROR) { 200 203 ret = response->fap.params[1]; 201 - dbg_hid("__hidpp_send_report got hidpp error %02X\n", ret); 204 + dbg_hid("%s:got hidpp 2.0 error %02X\n", __func__, ret); 202 205 goto exit; 203 206 } 204 207 ··· 282 271 static inline bool hidpp_match_error(struct hidpp_report *question, 283 272 struct hidpp_report *answer) 284 273 { 285 - return (answer->fap.feature_index == HIDPP_ERROR) && 274 + return ((answer->rap.sub_id == HIDPP_ERROR) || 275 + (answer->fap.feature_index == HIDPP20_ERROR)) && 286 276 (answer->fap.funcindex_clientid == question->fap.feature_index) && 287 277 (answer->fap.params[0] == question->fap.funcindex_clientid); 288 278 } ··· 915 903 return 0; 916 904 }; 917 905 918 - static void wtp_connect(struct hid_device *hdev, bool connected) 906 + static int wtp_connect(struct hid_device *hdev, bool connected) 919 907 { 920 908 struct hidpp_device *hidpp = hid_get_drvdata(hdev); 921 909 struct wtp_data *wd = hidpp->private_data; 922 910 int ret; 923 911 924 912 if (!connected) 925 - return; 913 + return 0; 926 914 927 915 if (!wd->x_size) { 928 916 ret = wtp_get_config(hidpp); 929 917 if (ret) { 930 918 hid_err(hdev, "Can not get wtp config: %d\n", ret); 931 - return; 919 + return ret; 932 920 } 933 921 } 934 922 935 - hidpp_touchpad_set_raw_report_state(hidpp, wd->mt_feature_index, 923 + return hidpp_touchpad_set_raw_report_state(hidpp, wd->mt_feature_index, 936 924 true, true); 937 925 } 938 926 ··· 977 965 978 966 /* 979 967 * If the mutex is locked then we have a pending answer from a 980 - * previoulsly sent command 968 + * previously sent command. 981 969 */ 982 970 if (unlikely(mutex_is_locked(&hidpp->send_mutex))) { 983 971 /* ··· 1008 996 return 1; 1009 997 } 1010 998 1011 - if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) 1012 - return wtp_raw_event(hidpp->hid_dev, data, size); 1013 - 1014 999 return 0; 1015 1000 } 1016 1001 ··· 1015 1006 u8 *data, int size) 1016 1007 { 1017 1008 struct hidpp_device *hidpp = hid_get_drvdata(hdev); 1009 + int ret = 0; 1018 1010 1011 + /* Generic HID++ processing. */ 1019 1012 switch (data[0]) { 1020 1013 case REPORT_ID_HIDPP_LONG: 1021 1014 if (size != HIDPP_REPORT_LONG_LENGTH) { ··· 1025 1014 size); 1026 1015 return 1; 1027 1016 } 1028 - return hidpp_raw_hidpp_event(hidpp, data, size); 1017 + ret = hidpp_raw_hidpp_event(hidpp, data, size); 1018 + break; 1029 1019 case REPORT_ID_HIDPP_SHORT: 1030 1020 if (size != HIDPP_REPORT_SHORT_LENGTH) { 1031 1021 hid_err(hdev, "received hid++ report of bad size (%d)", 1032 1022 size); 1033 1023 return 1; 1034 1024 } 1035 - return hidpp_raw_hidpp_event(hidpp, data, size); 1025 + ret = hidpp_raw_hidpp_event(hidpp, data, size); 1026 + break; 1036 1027 } 1028 + 1029 + /* If no report is available for further processing, skip calling 1030 + * raw_event of subclasses. */ 1031 + if (ret != 0) 1032 + return ret; 1037 1033 1038 1034 if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) 1039 1035 return wtp_raw_event(hdev, data, size); ··· 1088 1070 static struct input_dev *hidpp_allocate_input(struct hid_device *hdev) 1089 1071 { 1090 1072 struct input_dev *input_dev = devm_input_allocate_device(&hdev->dev); 1073 + struct hidpp_device *hidpp = hid_get_drvdata(hdev); 1091 1074 1092 1075 if (!input_dev) 1093 1076 return NULL; ··· 1097 1078 input_dev->open = hidpp_input_open; 1098 1079 input_dev->close = hidpp_input_close; 1099 1080 1100 - input_dev->name = hdev->name; 1081 + input_dev->name = hidpp->name; 1101 1082 input_dev->phys = hdev->phys; 1102 1083 input_dev->uniq = hdev->uniq; 1103 1084 input_dev->id.bustype = hdev->bus; ··· 1117 1098 struct input_dev *input; 1118 1099 char *name, *devm_name; 1119 1100 1120 - if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) 1121 - wtp_connect(hdev, connected); 1101 + if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) { 1102 + ret = wtp_connect(hdev, connected); 1103 + if (ret) 1104 + return; 1105 + } 1122 1106 1123 1107 if (!connected || hidpp->delayed_input) 1124 1108 return; ··· 1139 1117 hid_info(hdev, "HID++ %u.%u device connected.\n", 1140 1118 hidpp->protocol_major, hidpp->protocol_minor); 1141 1119 1120 + if (!hidpp->name || hidpp->name == hdev->name) { 1121 + name = hidpp_get_device_name(hidpp); 1122 + if (!name) { 1123 + hid_err(hdev, 1124 + "unable to retrieve the name of the device"); 1125 + return; 1126 + } 1127 + 1128 + devm_name = devm_kasprintf(&hdev->dev, GFP_KERNEL, "%s", name); 1129 + kfree(name); 1130 + if (!devm_name) 1131 + return; 1132 + 1133 + hidpp->name = devm_name; 1134 + } 1135 + 1142 1136 input = hidpp_allocate_input(hdev); 1143 1137 if (!input) { 1144 1138 hid_err(hdev, "cannot allocate new input device: %d\n", ret); 1145 1139 return; 1146 - } 1147 - 1148 - name = hidpp_get_device_name(hidpp); 1149 - if (!name) { 1150 - hid_err(hdev, "unable to retrieve the name of the device"); 1151 - } else { 1152 - devm_name = devm_kasprintf(&hdev->dev, GFP_KERNEL, "%s", name); 1153 - if (devm_name) 1154 - input->name = devm_name; 1155 - kfree(name); 1156 1140 } 1157 1141 1158 1142 hidpp_populate_input(hidpp, input, false); ··· 1183 1155 return -ENOMEM; 1184 1156 1185 1157 hidpp->hid_dev = hdev; 1158 + hidpp->name = hdev->name; 1186 1159 hid_set_drvdata(hdev, hidpp); 1187 1160 1188 1161 hidpp->quirks = id->driver_data;
+2
drivers/hid/hid-microsoft.c
··· 276 276 .driver_data = MS_DUPLICATE_USAGES }, 277 277 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3), 278 278 .driver_data = MS_HIDINPUT }, 279 + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP), 280 + .driver_data = MS_HIDINPUT }, 279 281 280 282 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT), 281 283 .driver_data = MS_PRESENTER },
+99 -21
drivers/hid/hid-rmi.c
··· 33 33 #define RMI_READ_DATA_PENDING BIT(1) 34 34 #define RMI_STARTED BIT(2) 35 35 36 + /* device flags */ 37 + #define RMI_DEVICE BIT(0) 38 + #define RMI_DEVICE_HAS_PHYS_BUTTONS BIT(1) 39 + 36 40 enum rmi_mode_type { 37 41 RMI_MODE_OFF = 0, 38 42 RMI_MODE_ATTN_REPORTS = 1, ··· 122 118 123 119 struct work_struct reset_work; 124 120 struct hid_device *hdev; 121 + 122 + unsigned long device_flags; 125 123 }; 126 124 127 125 #define RMI_PAGE(addr) (((addr) >> 8) & 0xff) ··· 458 452 return rmi_read_data_event(hdev, data, size); 459 453 case RMI_ATTN_REPORT_ID: 460 454 return rmi_input_event(hdev, data, size); 461 - case RMI_MOUSE_REPORT_ID: 455 + default: 456 + return 1; 457 + } 458 + 459 + return 0; 460 + } 461 + 462 + static int rmi_event(struct hid_device *hdev, struct hid_field *field, 463 + struct hid_usage *usage, __s32 value) 464 + { 465 + struct rmi_data *data = hid_get_drvdata(hdev); 466 + 467 + if ((data->device_flags & RMI_DEVICE) && 468 + (field->application == HID_GD_POINTER || 469 + field->application == HID_GD_MOUSE)) { 470 + if (data->device_flags & RMI_DEVICE_HAS_PHYS_BUTTONS) { 471 + if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) 472 + return 0; 473 + 474 + if ((usage->hid == HID_GD_X || usage->hid == HID_GD_Y) 475 + && !value) 476 + return 1; 477 + } 478 + 462 479 rmi_schedule_reset(hdev); 463 - break; 480 + return 1; 464 481 } 465 482 466 483 return 0; ··· 885 856 if (ret) 886 857 return; 887 858 859 + if (!(data->device_flags & RMI_DEVICE)) 860 + return; 861 + 888 862 /* Allow incoming hid reports */ 889 863 hid_device_io_start(hdev); 890 864 ··· 946 914 struct hid_input *hi, struct hid_field *field, 947 915 struct hid_usage *usage, unsigned long **bit, int *max) 948 916 { 949 - /* we want to make HID ignore the advertised HID collection */ 950 - return -1; 917 + struct rmi_data *data = hid_get_drvdata(hdev); 918 + 919 + /* 920 + * we want to make HID ignore the advertised HID collection 921 + * for RMI deivces 922 + */ 923 + if (data->device_flags & RMI_DEVICE) { 924 + if ((data->device_flags & RMI_DEVICE_HAS_PHYS_BUTTONS) && 925 + ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON)) 926 + return 0; 927 + 928 + return -1; 929 + } 930 + 931 + return 0; 932 + } 933 + 934 + static int rmi_check_valid_report_id(struct hid_device *hdev, unsigned type, 935 + unsigned id, struct hid_report **report) 936 + { 937 + int i; 938 + 939 + *report = hdev->report_enum[type].report_id_hash[id]; 940 + if (*report) { 941 + for (i = 0; i < (*report)->maxfield; i++) { 942 + unsigned app = (*report)->field[i]->application; 943 + if ((app & HID_USAGE_PAGE) >= HID_UP_MSVENDOR) 944 + return 1; 945 + } 946 + } 947 + 948 + return 0; 951 949 } 952 950 953 951 static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id) ··· 987 925 size_t alloc_size; 988 926 struct hid_report *input_report; 989 927 struct hid_report *output_report; 928 + struct hid_report *feature_report; 990 929 991 930 data = devm_kzalloc(&hdev->dev, sizeof(struct rmi_data), GFP_KERNEL); 992 931 if (!data) ··· 1006 943 return ret; 1007 944 } 1008 945 1009 - input_report = hdev->report_enum[HID_INPUT_REPORT] 1010 - .report_id_hash[RMI_ATTN_REPORT_ID]; 1011 - if (!input_report) { 1012 - hid_err(hdev, "device does not have expected input report\n"); 1013 - ret = -ENODEV; 1014 - return ret; 946 + if (id->driver_data) 947 + data->device_flags = id->driver_data; 948 + 949 + /* 950 + * Check for the RMI specific report ids. If they are misisng 951 + * simply return and let the events be processed by hid-input 952 + */ 953 + if (!rmi_check_valid_report_id(hdev, HID_FEATURE_REPORT, 954 + RMI_SET_RMI_MODE_REPORT_ID, &feature_report)) { 955 + hid_dbg(hdev, "device does not have set mode feature report\n"); 956 + goto start; 1015 957 } 1016 958 1017 - data->input_report_size = (input_report->size >> 3) + 1 /* report id */; 1018 - 1019 - output_report = hdev->report_enum[HID_OUTPUT_REPORT] 1020 - .report_id_hash[RMI_WRITE_REPORT_ID]; 1021 - if (!output_report) { 1022 - hid_err(hdev, "device does not have expected output report\n"); 1023 - ret = -ENODEV; 1024 - return ret; 959 + if (!rmi_check_valid_report_id(hdev, HID_INPUT_REPORT, 960 + RMI_ATTN_REPORT_ID, &input_report)) { 961 + hid_dbg(hdev, "device does not have attention input report\n"); 962 + goto start; 1025 963 } 1026 964 1027 - data->output_report_size = (output_report->size >> 3) 1028 - + 1 /* report id */; 965 + data->input_report_size = hid_report_len(input_report); 1029 966 967 + if (!rmi_check_valid_report_id(hdev, HID_OUTPUT_REPORT, 968 + RMI_WRITE_REPORT_ID, &output_report)) { 969 + hid_dbg(hdev, 970 + "device does not have rmi write output report\n"); 971 + goto start; 972 + } 973 + 974 + data->output_report_size = hid_report_len(output_report); 975 + 976 + data->device_flags |= RMI_DEVICE; 1030 977 alloc_size = data->output_report_size + data->input_report_size; 1031 978 1032 979 data->writeReport = devm_kzalloc(&hdev->dev, alloc_size, GFP_KERNEL); ··· 1051 978 1052 979 mutex_init(&data->page_mutex); 1053 980 981 + start: 1054 982 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 1055 983 if (ret) { 1056 984 hid_err(hdev, "hw start failed\n"); 1057 985 return ret; 1058 986 } 1059 987 1060 - if (!test_bit(RMI_STARTED, &data->flags)) 988 + if ((data->device_flags & RMI_DEVICE) && 989 + !test_bit(RMI_STARTED, &data->flags)) 1061 990 /* 1062 991 * The device maybe in the bootloader if rmi_input_configured 1063 992 * failed to find F11 in the PDT. Print an error, but don't ··· 1082 1007 } 1083 1008 1084 1009 static const struct hid_device_id rmi_id[] = { 1010 + { HID_USB_DEVICE(USB_VENDOR_ID_RAZER, USB_DEVICE_ID_RAZER_BLADE_14), 1011 + .driver_data = RMI_DEVICE_HAS_PHYS_BUTTONS }, 1085 1012 { HID_DEVICE(HID_BUS_ANY, HID_GROUP_RMI, HID_ANY_ID, HID_ANY_ID) }, 1086 1013 { } 1087 1014 }; ··· 1094 1017 .id_table = rmi_id, 1095 1018 .probe = rmi_probe, 1096 1019 .remove = rmi_remove, 1020 + .event = rmi_event, 1097 1021 .raw_event = rmi_raw_event, 1098 1022 .input_mapping = rmi_input_mapping, 1099 1023 .input_configured = rmi_input_configured,
+2 -10
drivers/hid/usbhid/Makefile
··· 2 2 # Makefile for the USB input drivers 3 3 # 4 4 5 - # Multipart objects. 6 5 usbhid-y := hid-core.o hid-quirks.o 7 - 8 - # Optional parts of multipart objects. 9 - 10 - ifeq ($(CONFIG_USB_HIDDEV),y) 11 - usbhid-y += hiddev.o 12 - endif 13 - ifeq ($(CONFIG_HID_PID),y) 14 - usbhid-y += hid-pidff.o 15 - endif 6 + usbhid-$(CONFIG_USB_HIDDEV) += hiddev.o 7 + usbhid-$(CONFIG_HID_PID) += hid-pidff.o 16 8 17 9 obj-$(CONFIG_USB_HID) += usbhid.o 18 10 obj-$(CONFIG_USB_KBD) += usbkbd.o
+6
drivers/hid/usbhid/hid-pidff.c
··· 1252 1252 1253 1253 pidff->hid = hid; 1254 1254 1255 + hid_device_io_start(hid); 1256 + 1255 1257 pidff_find_reports(hid, HID_OUTPUT_REPORT, pidff); 1256 1258 pidff_find_reports(hid, HID_FEATURE_REPORT, pidff); 1257 1259 ··· 1317 1315 1318 1316 hid_info(dev, "Force feedback for USB HID PID devices by Anssi Hannula <anssi.hannula@gmail.com>\n"); 1319 1317 1318 + hid_device_io_stop(hid); 1319 + 1320 1320 return 0; 1321 1321 1322 1322 fail: 1323 + hid_device_io_stop(hid); 1324 + 1323 1325 kfree(pidff); 1324 1326 return error; 1325 1327 }
+1
drivers/hid/usbhid/hid-quirks.c
··· 80 80 { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, 81 81 { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET }, 82 82 { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS }, 83 + { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP, HID_QUIRK_NO_INIT_REPORTS }, 83 84 { USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL, HID_QUIRK_NO_INIT_REPORTS }, 84 85 { USB_VENDOR_ID_NEXIO, USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750, HID_QUIRK_NO_INIT_REPORTS }, 85 86 { USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS },
+5 -4
drivers/hid/wacom_sys.c
··· 173 173 { 174 174 struct wacom *wacom = hid_get_drvdata(hdev); 175 175 struct wacom_features *features = &wacom->wacom_wac.features; 176 - bool finger = (field->logical == HID_DG_FINGER) || 177 - (field->physical == HID_DG_FINGER); 178 - bool pen = (field->logical == HID_DG_STYLUS) || 179 - (field->physical == HID_DG_STYLUS); 176 + bool finger = WACOM_FINGER_FIELD(field); 177 + bool pen = WACOM_PEN_FIELD(field); 180 178 181 179 /* 182 180 * Requiring Stylus Usage will ignore boot mouse ··· 402 404 } 403 405 else if (features->type == WACOM_24HDT || features->type == CINTIQ_HYBRID) { 404 406 return wacom_set_device_mode(hdev, 18, 3, 2); 407 + } 408 + else if (features->type == WACOM_27QHDT) { 409 + return wacom_set_device_mode(hdev, 131, 3, 2); 405 410 } 406 411 } else if (features->device_type == BTN_TOOL_PEN) { 407 412 if (features->type <= BAMBOO_PT && features->type != WIRELESS) {
+128 -113
drivers/hid/wacom_wac.c
··· 15 15 #include "wacom_wac.h" 16 16 #include "wacom.h" 17 17 #include <linux/input/mt.h> 18 - #include <linux/hid.h> 19 18 20 19 /* resolution for penabled devices */ 21 20 #define WACOM_PL_RES 20 ··· 443 444 444 445 /* Enter report */ 445 446 if ((data[1] & 0xfc) == 0xc0) { 446 - if (features->quirks & WACOM_QUIRK_MULTI_INPUT) 447 - wacom->shared->stylus_in_proximity = true; 448 - 449 447 /* serial number of the tool */ 450 448 wacom->serial[idx] = ((data[3] & 0x0f) << 28) + 451 449 (data[4] << 20) + (data[5] << 12) + ··· 531 535 return 1; 532 536 } 533 537 538 + /* 539 + * don't report events for invalid data 540 + */ 534 541 /* older I4 styli don't work with new Cintiqs */ 535 - if (!((wacom->id[idx] >> 20) & 0x01) && 536 - (features->type == WACOM_21UX2)) 542 + if ((!((wacom->id[idx] >> 20) & 0x01) && 543 + (features->type == WACOM_21UX2)) || 544 + /* Only large Intuos support Lense Cursor */ 545 + (wacom->tool[idx] == BTN_TOOL_LENS && 546 + (features->type == INTUOS3 || 547 + features->type == INTUOS3S || 548 + features->type == INTUOS4 || 549 + features->type == INTUOS4S || 550 + features->type == INTUOS5 || 551 + features->type == INTUOS5S || 552 + features->type == INTUOSPM || 553 + features->type == INTUOSPS)) || 554 + /* Cintiq doesn't send data when RDY bit isn't set */ 555 + (features->type == CINTIQ && !(data[1] & 0x40))) 537 556 return 1; 538 557 539 - /* Range Report */ 540 - if ((data[1] & 0xfe) == 0x20) { 558 + if (features->quirks & WACOM_QUIRK_MULTI_INPUT) 559 + wacom->shared->stylus_in_proximity = true; 560 + 561 + /* in Range while exiting */ 562 + if (((data[1] & 0xfe) == 0x20) && wacom->reporting_data) { 541 563 input_report_key(input, BTN_TOUCH, 0); 542 564 input_report_abs(input, ABS_PRESSURE, 0); 543 565 input_report_abs(input, ABS_DISTANCE, wacom->features.distance_max); 544 - if (features->quirks & WACOM_QUIRK_MULTI_INPUT) 545 - wacom->shared->stylus_in_proximity = true; 566 + return 2; 546 567 } 547 568 548 569 /* Exit report */ 549 570 if ((data[1] & 0xfe) == 0x80) { 550 571 if (features->quirks & WACOM_QUIRK_MULTI_INPUT) 551 572 wacom->shared->stylus_in_proximity = false; 573 + wacom->reporting_data = false; 574 + 575 + /* don't report exit if we don't know the ID */ 576 + if (!wacom->id[idx]) 577 + return 1; 552 578 553 579 /* 554 580 * Reset all states otherwise we lose the initial states ··· 604 586 wacom->id[idx] = 0; 605 587 return 2; 606 588 } 589 + 590 + /* don't report other events if we don't know the ID */ 591 + if (!wacom->id[idx]) 592 + return 1; 593 + 607 594 return 0; 608 595 } 609 596 ··· 656 633 data[0] != WACOM_REPORT_INTUOSREAD && 657 634 data[0] != WACOM_REPORT_INTUOSWRITE && 658 635 data[0] != WACOM_REPORT_INTUOSPAD && 636 + data[0] != WACOM_REPORT_CINTIQ && 637 + data[0] != WACOM_REPORT_CINTIQPAD && 659 638 data[0] != WACOM_REPORT_INTUOS5PAD) { 660 639 dev_dbg(input->dev.parent, 661 640 "%s: received unknown report #%d\n", __func__, data[0]); ··· 669 644 idx = data[1] & 0x01; 670 645 671 646 /* pad packets. Works as a second tool and is always in prox */ 672 - if (data[0] == WACOM_REPORT_INTUOSPAD || data[0] == WACOM_REPORT_INTUOS5PAD) { 647 + if (data[0] == WACOM_REPORT_INTUOSPAD || data[0] == WACOM_REPORT_INTUOS5PAD || 648 + data[0] == WACOM_REPORT_CINTIQPAD) { 673 649 input = wacom->pad_input; 674 650 if (features->type >= INTUOS4S && features->type <= INTUOS4L) { 675 651 input_report_key(input, BTN_0, (data[2] & 0x01)); ··· 770 744 } else { 771 745 input_report_abs(input, ABS_MISC, 0); 772 746 } 747 + } else if (features->type == WACOM_27QHD) { 748 + input_report_key(input, KEY_PROG1, data[2] & 0x01); 749 + input_report_key(input, KEY_PROG2, data[2] & 0x02); 750 + input_report_key(input, KEY_PROG3, data[2] & 0x04); 751 + 752 + input_report_abs(input, ABS_X, be16_to_cpup((__be16 *)&data[4])); 753 + input_report_abs(input, ABS_Y, be16_to_cpup((__be16 *)&data[6])); 754 + input_report_abs(input, ABS_Z, be16_to_cpup((__be16 *)&data[8])); 773 755 } else if (features->type == CINTIQ_HYBRID) { 774 756 /* 775 757 * Do not send hardware buttons under Android. They ··· 794 760 input_report_key(input, BTN_7, (data[4] & 0x40)); /* Left */ 795 761 input_report_key(input, BTN_8, (data[4] & 0x80)); /* Down */ 796 762 input_report_key(input, BTN_0, (data[3] & 0x01)); /* Center */ 763 + 764 + if (data[4] | (data[3] & 0x01)) { 765 + input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); 766 + } else { 767 + input_report_abs(input, ABS_MISC, 0); 768 + } 797 769 } else if (features->type >= INTUOS5S && features->type <= INTUOSPL) { 798 770 int i; 799 771 ··· 882 842 result = wacom_intuos_inout(wacom); 883 843 if (result) 884 844 return result - 1; 885 - 886 - /* don't proceed if we don't know the ID */ 887 - if (!wacom->id[idx]) 888 - return 0; 889 - 890 - /* Only large Intuos support Lense Cursor */ 891 - if (wacom->tool[idx] == BTN_TOOL_LENS && 892 - (features->type == INTUOS3 || 893 - features->type == INTUOS3S || 894 - features->type == INTUOS4 || 895 - features->type == INTUOS4S || 896 - features->type == INTUOS5 || 897 - features->type == INTUOS5S || 898 - features->type == INTUOSPM || 899 - features->type == INTUOSPS)) { 900 - 901 - return 0; 902 - } 903 - 904 - /* Cintiq doesn't send data when RDY bit isn't set */ 905 - if (features->type == CINTIQ && !(data[1] & 0x40)) 906 - return 0; 907 845 908 846 if (features->type >= INTUOS3S) { 909 847 input_report_abs(input, ABS_X, (data[2] << 9) | (data[3] << 1) | ((data[9] >> 1) & 1)); ··· 969 951 input_report_abs(input, ABS_MISC, wacom->id[idx]); /* report tool id */ 970 952 input_report_key(input, wacom->tool[idx], 1); 971 953 input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]); 954 + wacom->reporting_data = true; 972 955 return 1; 973 956 } 974 957 ··· 1038 1019 struct input_dev *input = wacom->input; 1039 1020 unsigned char *data = wacom->data; 1040 1021 int i; 1041 - int current_num_contacts = data[61]; 1022 + int current_num_contacts = 0; 1042 1023 int contacts_to_send = 0; 1024 + int num_contacts_left = 4; /* maximum contacts per packet */ 1025 + int byte_per_packet = WACOM_BYTES_PER_24HDT_PACKET; 1026 + int y_offset = 2; 1027 + 1028 + if (wacom->features.type == WACOM_27QHDT) { 1029 + current_num_contacts = data[63]; 1030 + num_contacts_left = 10; 1031 + byte_per_packet = WACOM_BYTES_PER_QHDTHID_PACKET; 1032 + y_offset = 0; 1033 + } else { 1034 + current_num_contacts = data[61]; 1035 + } 1043 1036 1044 1037 /* 1045 1038 * First packet resets the counter since only the first ··· 1060 1029 if (current_num_contacts) 1061 1030 wacom->num_contacts_left = current_num_contacts; 1062 1031 1063 - /* There are at most 4 contacts per packet */ 1064 - contacts_to_send = min(4, wacom->num_contacts_left); 1032 + contacts_to_send = min(num_contacts_left, wacom->num_contacts_left); 1065 1033 1066 1034 for (i = 0; i < contacts_to_send; i++) { 1067 - int offset = (WACOM_BYTES_PER_24HDT_PACKET * i) + 1; 1068 - bool touch = data[offset] & 0x1 && !wacom->shared->stylus_in_proximity; 1035 + int offset = (byte_per_packet * i) + 1; 1036 + bool touch = (data[offset] & 0x1) && !wacom->shared->stylus_in_proximity; 1069 1037 int slot = input_mt_get_slot_by_key(input, data[offset + 1]); 1070 1038 1071 1039 if (slot < 0) ··· 1074 1044 1075 1045 if (touch) { 1076 1046 int t_x = get_unaligned_le16(&data[offset + 2]); 1077 - int c_x = get_unaligned_le16(&data[offset + 4]); 1078 - int t_y = get_unaligned_le16(&data[offset + 6]); 1079 - int c_y = get_unaligned_le16(&data[offset + 8]); 1080 - int w = get_unaligned_le16(&data[offset + 10]); 1081 - int h = get_unaligned_le16(&data[offset + 12]); 1047 + int t_y = get_unaligned_le16(&data[offset + 4 + y_offset]); 1082 1048 1083 1049 input_report_abs(input, ABS_MT_POSITION_X, t_x); 1084 1050 input_report_abs(input, ABS_MT_POSITION_Y, t_y); 1085 - input_report_abs(input, ABS_MT_TOUCH_MAJOR, min(w,h)); 1086 - input_report_abs(input, ABS_MT_WIDTH_MAJOR, min(w, h) + int_dist(t_x, t_y, c_x, c_y)); 1087 - input_report_abs(input, ABS_MT_WIDTH_MINOR, min(w, h)); 1088 - input_report_abs(input, ABS_MT_ORIENTATION, w > h); 1051 + 1052 + if (wacom->features.type != WACOM_27QHDT) { 1053 + int c_x = get_unaligned_le16(&data[offset + 4]); 1054 + int c_y = get_unaligned_le16(&data[offset + 8]); 1055 + int w = get_unaligned_le16(&data[offset + 10]); 1056 + int h = get_unaligned_le16(&data[offset + 12]); 1057 + 1058 + input_report_abs(input, ABS_MT_TOUCH_MAJOR, min(w,h)); 1059 + input_report_abs(input, ABS_MT_WIDTH_MAJOR, 1060 + min(w, h) + int_dist(t_x, t_y, c_x, c_y)); 1061 + input_report_abs(input, ABS_MT_WIDTH_MINOR, min(w, h)); 1062 + input_report_abs(input, ABS_MT_ORIENTATION, w > h); 1063 + } 1089 1064 } 1090 1065 } 1091 1066 input_mt_report_pointer_emulation(input, true); ··· 1099 1064 if (wacom->num_contacts_left <= 0) 1100 1065 wacom->num_contacts_left = 0; 1101 1066 1067 + wacom->shared->touch_down = (wacom->num_contacts_left > 0); 1102 1068 return 1; 1103 1069 } 1104 1070 ··· 1128 1092 1129 1093 for (i = 0; i < contacts_to_send; i++) { 1130 1094 int offset = (WACOM_BYTES_PER_MT_PACKET + x_offset) * i + 3; 1131 - bool touch = data[offset] & 0x1; 1095 + bool touch = (data[offset] & 0x1) && !wacom->shared->stylus_in_proximity; 1132 1096 int id = get_unaligned_le16(&data[offset + 1]); 1133 1097 int slot = input_mt_get_slot_by_key(input, id); 1134 1098 ··· 1150 1114 if (wacom->num_contacts_left < 0) 1151 1115 wacom->num_contacts_left = 0; 1152 1116 1117 + wacom->shared->touch_down = (wacom->num_contacts_left > 0); 1153 1118 return 1; 1154 1119 } 1155 1120 ··· 1551 1514 wacom_wac->shared->touch_down = wacom_wac_finger_count_touches(hdev); 1552 1515 } 1553 1516 1554 - #define WACOM_PEN_FIELD(f) (((f)->logical == HID_DG_STYLUS) || \ 1555 - ((f)->physical == HID_DG_STYLUS) || \ 1556 - ((f)->application == HID_DG_PEN)) 1557 - #define WACOM_FINGER_FIELD(f) (((f)->logical == HID_DG_FINGER) || \ 1558 - ((f)->physical == HID_DG_FINGER) || \ 1559 - ((f)->application == HID_DG_TOUCHSCREEN)) 1560 - 1561 1517 void wacom_wac_usage_mapping(struct hid_device *hdev, 1562 1518 struct hid_field *field, struct hid_usage *usage) 1563 1519 { ··· 1921 1891 case WACOM_21UX2: 1922 1892 case WACOM_22HD: 1923 1893 case WACOM_24HD: 1894 + case WACOM_27QHD: 1924 1895 case DTK: 1925 1896 case CINTIQ_HYBRID: 1926 1897 sync = wacom_intuos_irq(wacom_wac); ··· 1932 1901 break; 1933 1902 1934 1903 case WACOM_24HDT: 1904 + case WACOM_27QHDT: 1935 1905 sync = wacom_24hdt_irq(wacom_wac); 1936 1906 break; 1937 1907 ··· 2118 2086 wacom_abs_set_axis(input_dev, wacom_wac); 2119 2087 2120 2088 switch (features->type) { 2089 + case GRAPHIRE_BT: 2090 + __clear_bit(ABS_MISC, input_dev->absbit); 2091 + 2121 2092 case WACOM_MO: 2122 2093 case WACOM_G4: 2094 + input_set_abs_params(input_dev, ABS_DISTANCE, 0, 2095 + features->distance_max, 2096 + 0, 0); 2123 2097 /* fall through */ 2124 2098 2125 2099 case GRAPHIRE: ··· 2144 2106 __set_bit(INPUT_PROP_POINTER, input_dev->propbit); 2145 2107 break; 2146 2108 2147 - case GRAPHIRE_BT: 2148 - __clear_bit(ABS_MISC, input_dev->absbit); 2149 - input_set_abs_params(input_dev, ABS_DISTANCE, 0, 2150 - features->distance_max, 2151 - 0, 0); 2152 - 2153 - input_set_capability(input_dev, EV_REL, REL_WHEEL); 2154 - 2155 - __set_bit(BTN_LEFT, input_dev->keybit); 2156 - __set_bit(BTN_RIGHT, input_dev->keybit); 2157 - __set_bit(BTN_MIDDLE, input_dev->keybit); 2158 - 2159 - __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); 2160 - __set_bit(BTN_TOOL_PEN, input_dev->keybit); 2161 - __set_bit(BTN_TOOL_MOUSE, input_dev->keybit); 2162 - __set_bit(BTN_STYLUS, input_dev->keybit); 2163 - __set_bit(BTN_STYLUS2, input_dev->keybit); 2164 - 2165 - __set_bit(INPUT_PROP_POINTER, input_dev->propbit); 2166 - break; 2167 - 2109 + case WACOM_27QHD: 2168 2110 case WACOM_24HD: 2169 - input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); 2170 - input_abs_set_res(input_dev, ABS_Z, 287); 2171 - input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0); 2172 - /* fall through */ 2173 - 2174 2111 case DTK: 2175 - __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); 2176 - 2177 - wacom_setup_cintiq(wacom_wac); 2178 - break; 2179 - 2180 2112 case WACOM_22HD: 2181 2113 case WACOM_21UX2: 2182 2114 case WACOM_BEE: 2183 2115 case CINTIQ: 2184 - input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); 2185 - input_abs_set_res(input_dev, ABS_Z, 287); 2186 - 2187 - __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); 2188 - 2189 - wacom_setup_cintiq(wacom_wac); 2190 - break; 2191 - 2192 2116 case WACOM_13HD: 2117 + case CINTIQ_HYBRID: 2193 2118 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); 2194 2119 input_abs_set_res(input_dev, ABS_Z, 287); 2195 2120 __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); ··· 2162 2161 case INTUOS3: 2163 2162 case INTUOS3L: 2164 2163 case INTUOS3S: 2164 + case INTUOS4: 2165 + case INTUOS4WL: 2166 + case INTUOS4L: 2167 + case INTUOS4S: 2165 2168 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); 2166 2169 input_abs_set_res(input_dev, ABS_Z, 287); 2167 2170 /* fall through */ ··· 2204 2199 } 2205 2200 break; 2206 2201 2207 - case INTUOS4: 2208 - case INTUOS4WL: 2209 - case INTUOS4L: 2210 - case INTUOS4S: 2211 - input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); 2212 - input_abs_set_res(input_dev, ABS_Z, 287); 2213 - wacom_setup_intuos(wacom_wac); 2214 - 2215 - __set_bit(INPUT_PROP_POINTER, input_dev->propbit); 2216 - break; 2217 - 2218 2202 case WACOM_24HDT: 2219 2203 if (features->device_type == BTN_TOOL_FINGER) { 2220 2204 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0); ··· 2213 2219 } 2214 2220 /* fall through */ 2215 2221 2222 + case WACOM_27QHDT: 2216 2223 case MTSCREEN: 2217 2224 case MTTPC: 2218 2225 case MTTPC_B: ··· 2300 2305 0, 0); 2301 2306 } 2302 2307 break; 2303 - 2304 - case CINTIQ_HYBRID: 2305 - input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); 2306 - input_abs_set_res(input_dev, ABS_Z, 287); 2307 - __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); 2308 - 2309 - wacom_setup_cintiq(wacom_wac); 2310 - break; 2311 2308 } 2312 2309 return 0; 2313 2310 } ··· 2359 2372 2360 2373 input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); 2361 2374 input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0); 2375 + break; 2376 + 2377 + case WACOM_27QHD: 2378 + __set_bit(KEY_PROG1, input_dev->keybit); 2379 + __set_bit(KEY_PROG2, input_dev->keybit); 2380 + __set_bit(KEY_PROG3, input_dev->keybit); 2381 + input_set_abs_params(input_dev, ABS_X, -2048, 2048, 0, 0); 2382 + input_abs_set_res(input_dev, ABS_X, 1024); /* points/g */ 2383 + input_set_abs_params(input_dev, ABS_Y, -2048, 2048, 0, 0); 2384 + input_abs_set_res(input_dev, ABS_Y, 1024); 2385 + input_set_abs_params(input_dev, ABS_Z, -2048, 2048, 0, 0); 2386 + input_abs_set_res(input_dev, ABS_Z, 1024); 2387 + __set_bit(INPUT_PROP_ACCELEROMETER, input_dev->propbit); 2362 2388 break; 2363 2389 2364 2390 case DTK: ··· 2724 2724 { "Wacom Cintiq 24HD touch", .type = WACOM_24HDT, /* Touch */ 2725 2725 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf8, .touch_max = 10, 2726 2726 .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; 2727 + static const struct wacom_features wacom_features_0x32A = 2728 + { "Wacom Cintiq 27QHD", 119740, 67520, 2047, 2729 + 63, WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 2730 + WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 2731 + static const struct wacom_features wacom_features_0x32B = 2732 + { "Wacom Cintiq 27QHD touch", 119740, 67520, 2047, 63, 2733 + WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 2734 + WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, 2735 + .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x32C }; 2736 + static const struct wacom_features wacom_features_0x32C = 2737 + { "Wacom Cintiq 27QHD touch", .type = WACOM_27QHDT, 2738 + .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x32B, .touch_max = 10 }; 2727 2739 static const struct wacom_features wacom_features_0x3F = 2728 2740 { "Wacom Cintiq 21UX", 87200, 65600, 1023, 63, 2729 2741 CINTIQ, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; ··· 3102 3090 { USB_DEVICE_WACOM(0x315) }, 3103 3091 { USB_DEVICE_WACOM(0x317) }, 3104 3092 { USB_DEVICE_WACOM(0x323) }, 3093 + { USB_DEVICE_WACOM(0x32A) }, 3094 + { USB_DEVICE_WACOM(0x32B) }, 3095 + { USB_DEVICE_WACOM(0x32C) }, 3105 3096 { USB_DEVICE_WACOM(0x32F) }, 3106 3097 { USB_DEVICE_WACOM(0x4001) }, 3107 3098 { USB_DEVICE_WACOM(0x4004) },
+16 -1
drivers/hid/wacom_wac.h
··· 10 10 #define WACOM_WAC_H 11 11 12 12 #include <linux/types.h> 13 + #include <linux/hid.h> 13 14 14 15 /* maximum packet length for USB devices */ 15 - #define WACOM_PKGLEN_MAX 68 16 + #define WACOM_PKGLEN_MAX 192 16 17 17 18 #define WACOM_NAME_MAX 64 18 19 ··· 37 36 /* wacom data size per MT contact */ 38 37 #define WACOM_BYTES_PER_MT_PACKET 11 39 38 #define WACOM_BYTES_PER_24HDT_PACKET 14 39 + #define WACOM_BYTES_PER_QHDTHID_PACKET 6 40 40 41 41 /* device IDs */ 42 42 #define STYLUS_DEVICE_ID 0x02 ··· 59 57 #define WACOM_REPORT_TPCMT 13 60 58 #define WACOM_REPORT_TPCMT2 3 61 59 #define WACOM_REPORT_TPCHID 15 60 + #define WACOM_REPORT_CINTIQ 16 61 + #define WACOM_REPORT_CINTIQPAD 17 62 62 #define WACOM_REPORT_TPCST 16 63 63 #define WACOM_REPORT_DTUS 17 64 64 #define WACOM_REPORT_TPC1FGE 18 ··· 74 70 #define WACOM_QUIRK_NO_INPUT 0x0004 75 71 #define WACOM_QUIRK_MONITOR 0x0008 76 72 #define WACOM_QUIRK_BATTERY 0x0010 73 + 74 + #define WACOM_PEN_FIELD(f) (((f)->logical == HID_DG_STYLUS) || \ 75 + ((f)->physical == HID_DG_STYLUS) || \ 76 + ((f)->physical == HID_DG_PEN) || \ 77 + ((f)->application == HID_DG_PEN)) 78 + #define WACOM_FINGER_FIELD(f) (((f)->logical == HID_DG_FINGER) || \ 79 + ((f)->physical == HID_DG_FINGER) || \ 80 + ((f)->application == HID_DG_TOUCHSCREEN)) 77 81 78 82 enum { 79 83 PENPARTNER = 0, ··· 112 100 WACOM_22HD, 113 101 DTK, 114 102 WACOM_24HD, 103 + WACOM_27QHD, 115 104 CINTIQ_HYBRID, 116 105 CINTIQ, 117 106 WACOM_BEE, ··· 121 108 WIRELESS, 122 109 BAMBOO_PT, 123 110 WACOM_24HDT, 111 + WACOM_27QHDT, 124 112 TABLETPC, /* add new TPC below */ 125 113 TABLETPCE, 126 114 TABLETPC2FG, ··· 194 180 int tool[2]; 195 181 int id[2]; 196 182 __u32 serial[2]; 183 + bool reporting_data; 197 184 struct wacom_features features; 198 185 struct wacom_shared *shared; 199 186 struct input_dev *input;
+3 -1
include/linux/hid.h
··· 574 574 #define HID_GLOBAL_STACK_SIZE 4 575 575 #define HID_COLLECTION_STACK_SIZE 4 576 576 577 - #define HID_SCAN_FLAG_MT_WIN_8 0x00000001 577 + #define HID_SCAN_FLAG_MT_WIN_8 BIT(0) 578 + #define HID_SCAN_FLAG_VENDOR_SPECIFIC BIT(1) 579 + #define HID_SCAN_FLAG_GD_POINTER BIT(2) 578 580 579 581 struct hid_parser { 580 582 struct hid_global global;
+1
include/uapi/linux/input.h
··· 166 166 #define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */ 167 167 #define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */ 168 168 #define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */ 169 + #define INPUT_PROP_ACCELEROMETER 0x06 /* has accelerometer */ 169 170 170 171 #define INPUT_PROP_MAX 0x1f 171 172 #define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)