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 fixes from Jiri Kosina:

- corner-case oops fixes for Asus and Wacom drivers from Carlo Caione
and Jason Gerecke

- power management fix (reported on SIS0817 touchscreen) for i2c-hid
devices from Hans de Goede

- device-id-specific fixes and quirks from Hans de Goede, Diego Elio
Pettenò and Che-Liang Chiou

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
HID: asus: Stop underlying hardware on remove
HID: i2c: Call acpi_device_fix_up_power for ACPI-enumerated devices
HID: asus: Add support for T100 keyboard
HID: elecom: extend to fix the descriptor for DEFT trackballs
HID: magicmouse: Set multi-touch keybits for Magic Mouse
HID: wacom: Have wacom_tpc_irq guard against possible NULL dereference

+120 -41
+4 -2
drivers/hid/Kconfig
··· 275 275 - Trio Linker Plus II 276 276 277 277 config HID_ELECOM 278 - tristate "ELECOM BM084 bluetooth mouse" 278 + tristate "ELECOM HID devices" 279 279 depends on HID 280 280 ---help--- 281 - Support for the ELECOM BM084 (bluetooth mouse). 281 + Support for ELECOM devices: 282 + - BM084 Bluetooth Mouse 283 + - DEFT Trackball (Wired and wireless) 282 284 283 285 config HID_ELO 284 286 tristate "ELO USB 4000/4500 touchscreen"
+12
drivers/hid/hid-asus.c
··· 69 69 #define QUIRK_IS_MULTITOUCH BIT(3) 70 70 #define QUIRK_NO_CONSUMER_USAGES BIT(4) 71 71 #define QUIRK_USE_KBD_BACKLIGHT BIT(5) 72 + #define QUIRK_T100_KEYBOARD BIT(6) 72 73 73 74 #define I2C_KEYBOARD_QUIRKS (QUIRK_FIX_NOTEBOOK_REPORT | \ 74 75 QUIRK_NO_INIT_REPORTS | \ ··· 537 536 drvdata->kbd_backlight->removed = true; 538 537 cancel_work_sync(&drvdata->kbd_backlight->work); 539 538 } 539 + 540 + hid_hw_stop(hdev); 540 541 } 541 542 542 543 static __u8 *asus_report_fixup(struct hid_device *hdev, __u8 *rdesc, ··· 551 548 hid_info(hdev, "Fixing up Asus notebook report descriptor\n"); 552 549 rdesc[55] = 0xdd; 553 550 } 551 + if (drvdata->quirks & QUIRK_T100_KEYBOARD && 552 + *rsize == 76 && rdesc[73] == 0x81 && rdesc[74] == 0x01) { 553 + hid_info(hdev, "Fixing up Asus T100 keyb report descriptor\n"); 554 + rdesc[74] &= ~HID_MAIN_ITEM_CONSTANT; 555 + } 556 + 554 557 return rdesc; 555 558 } 556 559 ··· 569 560 USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1) }, 570 561 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, 571 562 USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2), QUIRK_USE_KBD_BACKLIGHT }, 563 + { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, 564 + USB_DEVICE_ID_ASUSTEK_T100_KEYBOARD), 565 + QUIRK_T100_KEYBOARD | QUIRK_NO_CONSUMER_USAGES }, 572 566 { } 573 567 }; 574 568 MODULE_DEVICE_TABLE(hid, asus_devices);
+3
drivers/hid/hid-core.c
··· 1855 1855 { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD) }, 1856 1856 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1) }, 1857 1857 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2) }, 1858 + { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_T100_KEYBOARD) }, 1858 1859 { HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) }, 1859 1860 { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) }, 1860 1861 { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) }, ··· 1892 1891 { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, USB_DEVICE_ID_DREAM_CHEEKY_WN) }, 1893 1892 { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, USB_DEVICE_ID_DREAM_CHEEKY_FA) }, 1894 1893 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) }, 1894 + { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_DEFT_WIRED) }, 1895 + { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_DEFT_WIRELESS) }, 1895 1896 { HID_USB_DEVICE(USB_VENDOR_ID_ELO, 0x0009) }, 1896 1897 { HID_USB_DEVICE(USB_VENDOR_ID_ELO, 0x0030) }, 1897 1898 { HID_USB_DEVICE(USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_ACCUTOUCH_2216) },
+53 -9
drivers/hid/hid-elecom.c
··· 1 1 /* 2 - * HID driver for Elecom BM084 (bluetooth mouse). 3 - * Removes a non-existing horizontal wheel from 4 - * the HID descriptor. 5 - * (This module is based on "hid-ortek".) 6 - * 2 + * HID driver for ELECOM devices. 7 3 * Copyright (c) 2010 Richard Nauber <Richard.Nauber@gmail.com> 4 + * Copyright (c) 2016 Yuxuan Shui <yshuiv7@gmail.com> 5 + * Copyright (c) 2017 Diego Elio Pettenò <flameeyes@flameeyes.eu> 8 6 */ 9 7 10 8 /* ··· 21 23 static __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc, 22 24 unsigned int *rsize) 23 25 { 24 - if (*rsize >= 48 && rdesc[46] == 0x05 && rdesc[47] == 0x0c) { 25 - hid_info(hdev, "Fixing up Elecom BM084 report descriptor\n"); 26 - rdesc[47] = 0x00; 26 + switch (hdev->product) { 27 + case USB_DEVICE_ID_ELECOM_BM084: 28 + /* The BM084 Bluetooth mouse includes a non-existing horizontal 29 + * wheel in the HID descriptor. */ 30 + if (*rsize >= 48 && rdesc[46] == 0x05 && rdesc[47] == 0x0c) { 31 + hid_info(hdev, "Fixing up Elecom BM084 report descriptor\n"); 32 + rdesc[47] = 0x00; 33 + } 34 + break; 35 + case USB_DEVICE_ID_ELECOM_DEFT_WIRED: 36 + case USB_DEVICE_ID_ELECOM_DEFT_WIRELESS: 37 + /* The DEFT trackball has eight buttons, but its descriptor only 38 + * reports five, disabling the three Fn buttons on the top of 39 + * the mouse. 40 + * 41 + * Apply the following diff to the descriptor: 42 + * 43 + * Collection (Physical), Collection (Physical), 44 + * Report ID (1), Report ID (1), 45 + * Report Count (5), -> Report Count (8), 46 + * Report Size (1), Report Size (1), 47 + * Usage Page (Button), Usage Page (Button), 48 + * Usage Minimum (01h), Usage Minimum (01h), 49 + * Usage Maximum (05h), -> Usage Maximum (08h), 50 + * Logical Minimum (0), Logical Minimum (0), 51 + * Logical Maximum (1), Logical Maximum (1), 52 + * Input (Variable), Input (Variable), 53 + * Report Count (1), -> Report Count (0), 54 + * Report Size (3), Report Size (3), 55 + * Input (Constant), Input (Constant), 56 + * Report Size (16), Report Size (16), 57 + * Report Count (2), Report Count (2), 58 + * Usage Page (Desktop), Usage Page (Desktop), 59 + * Usage (X), Usage (X), 60 + * Usage (Y), Usage (Y), 61 + * Logical Minimum (-32768), Logical Minimum (-32768), 62 + * Logical Maximum (32767), Logical Maximum (32767), 63 + * Input (Variable, Relative), Input (Variable, Relative), 64 + * End Collection, End Collection, 65 + */ 66 + if (*rsize == 213 && rdesc[13] == 5 && rdesc[21] == 5) { 67 + hid_info(hdev, "Fixing up Elecom DEFT Fn buttons\n"); 68 + rdesc[13] = 8; /* Button/Variable Report Count */ 69 + rdesc[21] = 8; /* Button/Variable Usage Maximum */ 70 + rdesc[29] = 0; /* Button/Constant Report Count */ 71 + } 72 + break; 27 73 } 28 74 return rdesc; 29 75 } 30 76 31 77 static const struct hid_device_id elecom_devices[] = { 32 - { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084)}, 78 + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) }, 79 + { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_DEFT_WIRED) }, 80 + { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_DEFT_WIRELESS) }, 33 81 { } 34 82 }; 35 83 MODULE_DEVICE_TABLE(hid, elecom_devices);
+3
drivers/hid/hid-ids.h
··· 173 173 #define USB_VENDOR_ID_ASUSTEK 0x0b05 174 174 #define USB_DEVICE_ID_ASUSTEK_LCM 0x1726 175 175 #define USB_DEVICE_ID_ASUSTEK_LCM2 0x175b 176 + #define USB_DEVICE_ID_ASUSTEK_T100_KEYBOARD 0x17e0 176 177 #define USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD 0x8585 177 178 #define USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD 0x0101 178 179 #define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1 0x1854 ··· 359 358 360 359 #define USB_VENDOR_ID_ELECOM 0x056e 361 360 #define USB_DEVICE_ID_ELECOM_BM084 0x0061 361 + #define USB_DEVICE_ID_ELECOM_DEFT_WIRED 0x00fe 362 + #define USB_DEVICE_ID_ELECOM_DEFT_WIRELESS 0x00ff 362 363 363 364 #define USB_VENDOR_ID_DREAM_CHEEKY 0x1d34 364 365 #define USB_DEVICE_ID_DREAM_CHEEKY_WN 0x0004
+8 -7
drivers/hid/hid-magicmouse.c
··· 349 349 350 350 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) { 351 351 magicmouse_emit_buttons(msc, clicks & 3); 352 + input_mt_report_pointer_emulation(input, true); 352 353 input_report_rel(input, REL_X, x); 353 354 input_report_rel(input, REL_Y, y); 354 355 } else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */ ··· 389 388 __clear_bit(BTN_RIGHT, input->keybit); 390 389 __clear_bit(BTN_MIDDLE, input->keybit); 391 390 __set_bit(BTN_MOUSE, input->keybit); 392 - __set_bit(BTN_TOOL_FINGER, input->keybit); 393 - __set_bit(BTN_TOOL_DOUBLETAP, input->keybit); 394 - __set_bit(BTN_TOOL_TRIPLETAP, input->keybit); 395 - __set_bit(BTN_TOOL_QUADTAP, input->keybit); 396 - __set_bit(BTN_TOOL_QUINTTAP, input->keybit); 397 - __set_bit(BTN_TOUCH, input->keybit); 398 - __set_bit(INPUT_PROP_POINTER, input->propbit); 399 391 __set_bit(INPUT_PROP_BUTTONPAD, input->propbit); 400 392 } 401 393 394 + __set_bit(BTN_TOOL_FINGER, input->keybit); 395 + __set_bit(BTN_TOOL_DOUBLETAP, input->keybit); 396 + __set_bit(BTN_TOOL_TRIPLETAP, input->keybit); 397 + __set_bit(BTN_TOOL_QUADTAP, input->keybit); 398 + __set_bit(BTN_TOOL_QUINTTAP, input->keybit); 399 + __set_bit(BTN_TOUCH, input->keybit); 400 + __set_bit(INPUT_PROP_POINTER, input->propbit); 402 401 403 402 __set_bit(EV_ABS, input->evbit); 404 403
+13
drivers/hid/i2c-hid/i2c-hid.c
··· 897 897 return 0; 898 898 } 899 899 900 + static void i2c_hid_acpi_fix_up_power(struct device *dev) 901 + { 902 + acpi_handle handle = ACPI_HANDLE(dev); 903 + struct acpi_device *adev; 904 + 905 + if (handle && acpi_bus_get_device(handle, &adev) == 0) 906 + acpi_device_fix_up_power(adev); 907 + } 908 + 900 909 static const struct acpi_device_id i2c_hid_acpi_match[] = { 901 910 {"ACPI0C50", 0 }, 902 911 {"PNP0C50", 0 }, ··· 918 909 { 919 910 return -ENODEV; 920 911 } 912 + 913 + static inline void i2c_hid_acpi_fix_up_power(struct device *dev) {} 921 914 #endif 922 915 923 916 #ifdef CONFIG_OF ··· 1040 1029 ret = i2c_hid_alloc_buffers(ihid, HID_MIN_BUFFER_SIZE); 1041 1030 if (ret < 0) 1042 1031 goto err_regulator; 1032 + 1033 + i2c_hid_acpi_fix_up_power(&client->dev); 1043 1034 1044 1035 pm_runtime_get_noresume(&client->dev); 1045 1036 pm_runtime_set_active(&client->dev);
+24 -23
drivers/hid/wacom_wac.c
··· 1571 1571 { 1572 1572 unsigned char *data = wacom->data; 1573 1573 1574 - if (wacom->pen_input) 1574 + if (wacom->pen_input) { 1575 1575 dev_dbg(wacom->pen_input->dev.parent, 1576 1576 "%s: received report #%d\n", __func__, data[0]); 1577 - else if (wacom->touch_input) 1577 + 1578 + if (len == WACOM_PKGLEN_PENABLED || 1579 + data[0] == WACOM_REPORT_PENABLED) 1580 + return wacom_tpc_pen(wacom); 1581 + } 1582 + else if (wacom->touch_input) { 1578 1583 dev_dbg(wacom->touch_input->dev.parent, 1579 1584 "%s: received report #%d\n", __func__, data[0]); 1580 1585 1581 - switch (len) { 1582 - case WACOM_PKGLEN_TPC1FG: 1583 - return wacom_tpc_single_touch(wacom, len); 1584 - 1585 - case WACOM_PKGLEN_TPC2FG: 1586 - return wacom_tpc_mt_touch(wacom); 1587 - 1588 - case WACOM_PKGLEN_PENABLED: 1589 - return wacom_tpc_pen(wacom); 1590 - 1591 - default: 1592 - switch (data[0]) { 1593 - case WACOM_REPORT_TPC1FG: 1594 - case WACOM_REPORT_TPCHID: 1595 - case WACOM_REPORT_TPCST: 1596 - case WACOM_REPORT_TPC1FGE: 1586 + switch (len) { 1587 + case WACOM_PKGLEN_TPC1FG: 1597 1588 return wacom_tpc_single_touch(wacom, len); 1598 1589 1599 - case WACOM_REPORT_TPCMT: 1600 - case WACOM_REPORT_TPCMT2: 1601 - return wacom_mt_touch(wacom); 1590 + case WACOM_PKGLEN_TPC2FG: 1591 + return wacom_tpc_mt_touch(wacom); 1602 1592 1603 - case WACOM_REPORT_PENABLED: 1604 - return wacom_tpc_pen(wacom); 1593 + default: 1594 + switch (data[0]) { 1595 + case WACOM_REPORT_TPC1FG: 1596 + case WACOM_REPORT_TPCHID: 1597 + case WACOM_REPORT_TPCST: 1598 + case WACOM_REPORT_TPC1FGE: 1599 + return wacom_tpc_single_touch(wacom, len); 1600 + 1601 + case WACOM_REPORT_TPCMT: 1602 + case WACOM_REPORT_TPCMT2: 1603 + return wacom_mt_touch(wacom); 1604 + 1605 + } 1605 1606 } 1606 1607 } 1607 1608