diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-05-09 16:49:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-05-09 16:49:52 -0400 |
commit | 008464a9360e31b14677457dcd976fbf9dd58e2e (patch) | |
tree | 7537285738221f145aca03c61b102dd60d32a43a | |
parent | 036db8bd96374c66424f270f3370ddaf0adf7506 (diff) | |
parent | 070b9637dd8fa85c3ba7ecc60fe57fa4da9c2d1d (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Pull HID fixes from Jiri Kosina:
- quirk for Toshiba Click Mini L9W-B, from Hans de Goede
- intel-ish-hid and wacom error handling (device freeing) path fixes
from Arvind Yadav
- memory corruption fix in intel-ish-hid driver from Hans de Goede
- a few new device ID additions to hid-lenovo from Peter Ganzhorn
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
HID: i2c-hid: Add RESEND_REPORT_DESCR quirk for Toshiba Click Mini L9W-B
HID: intel-ish-hid: use put_device() instead of kfree()
HID: intel_ish-hid: Stop using a static local buffer in get_report()
HID: intel_ish-hid: Move header size check to inside the loop
HID: wacom: Release device resource data obtained by devres_alloc()
HID: lenovo: Add support for IBM/Lenovo Scrollpoint mice
-rw-r--r-- | drivers/hid/Kconfig | 7 | ||||
-rw-r--r-- | drivers/hid/hid-ids.h | 9 | ||||
-rw-r--r-- | drivers/hid/hid-lenovo.c | 36 | ||||
-rw-r--r-- | drivers/hid/i2c-hid/i2c-hid.c | 2 | ||||
-rw-r--r-- | drivers/hid/intel-ish-hid/ishtp-hid-client.c | 36 | ||||
-rw-r--r-- | drivers/hid/intel-ish-hid/ishtp/bus.c | 2 | ||||
-rw-r--r-- | drivers/hid/wacom_sys.c | 4 |
7 files changed, 71 insertions, 25 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 60252fd796f6..0000434a1fbd 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
@@ -462,10 +462,11 @@ config HID_LENOVO | |||
462 | select NEW_LEDS | 462 | select NEW_LEDS |
463 | select LEDS_CLASS | 463 | select LEDS_CLASS |
464 | ---help--- | 464 | ---help--- |
465 | Support for Lenovo devices that are not fully compliant with HID standard. | 465 | Support for IBM/Lenovo devices that are not fully compliant with HID standard. |
466 | 466 | ||
467 | Say Y if you want support for the non-compliant features of the Lenovo | 467 | Say Y if you want support for horizontal scrolling of the IBM/Lenovo |
468 | Thinkpad standalone keyboards, e.g: | 468 | Scrollpoint mice or the non-compliant features of the Lenovo Thinkpad |
469 | standalone keyboards, e.g: | ||
469 | - ThinkPad USB Keyboard with TrackPoint (supports extra LEDs and trackpoint | 470 | - ThinkPad USB Keyboard with TrackPoint (supports extra LEDs and trackpoint |
470 | configuration) | 471 | configuration) |
471 | - ThinkPad Compact Bluetooth Keyboard with TrackPoint (supports Fn keys) | 472 | - ThinkPad Compact Bluetooth Keyboard with TrackPoint (supports Fn keys) |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 0b5cc910f62e..46f5ecd11bf7 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -552,6 +552,13 @@ | |||
552 | #define USB_VENDOR_ID_HUION 0x256c | 552 | #define USB_VENDOR_ID_HUION 0x256c |
553 | #define USB_DEVICE_ID_HUION_TABLET 0x006e | 553 | #define USB_DEVICE_ID_HUION_TABLET 0x006e |
554 | 554 | ||
555 | #define USB_VENDOR_ID_IBM 0x04b3 | ||
556 | #define USB_DEVICE_ID_IBM_SCROLLPOINT_III 0x3100 | ||
557 | #define USB_DEVICE_ID_IBM_SCROLLPOINT_PRO 0x3103 | ||
558 | #define USB_DEVICE_ID_IBM_SCROLLPOINT_OPTICAL 0x3105 | ||
559 | #define USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL 0x3108 | ||
560 | #define USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL_PRO 0x3109 | ||
561 | |||
555 | #define USB_VENDOR_ID_IDEACOM 0x1cb6 | 562 | #define USB_VENDOR_ID_IDEACOM 0x1cb6 |
556 | #define USB_DEVICE_ID_IDEACOM_IDC6650 0x6650 | 563 | #define USB_DEVICE_ID_IDEACOM_IDC6650 0x6650 |
557 | #define USB_DEVICE_ID_IDEACOM_IDC6651 0x6651 | 564 | #define USB_DEVICE_ID_IDEACOM_IDC6651 0x6651 |
@@ -684,6 +691,7 @@ | |||
684 | #define USB_DEVICE_ID_LENOVO_TPKBD 0x6009 | 691 | #define USB_DEVICE_ID_LENOVO_TPKBD 0x6009 |
685 | #define USB_DEVICE_ID_LENOVO_CUSBKBD 0x6047 | 692 | #define USB_DEVICE_ID_LENOVO_CUSBKBD 0x6047 |
686 | #define USB_DEVICE_ID_LENOVO_CBTKBD 0x6048 | 693 | #define USB_DEVICE_ID_LENOVO_CBTKBD 0x6048 |
694 | #define USB_DEVICE_ID_LENOVO_SCROLLPOINT_OPTICAL 0x6049 | ||
687 | #define USB_DEVICE_ID_LENOVO_TPPRODOCK 0x6067 | 695 | #define USB_DEVICE_ID_LENOVO_TPPRODOCK 0x6067 |
688 | #define USB_DEVICE_ID_LENOVO_X1_COVER 0x6085 | 696 | #define USB_DEVICE_ID_LENOVO_X1_COVER 0x6085 |
689 | #define USB_DEVICE_ID_LENOVO_X1_TAB 0x60a3 | 697 | #define USB_DEVICE_ID_LENOVO_X1_TAB 0x60a3 |
@@ -964,6 +972,7 @@ | |||
964 | #define USB_DEVICE_ID_SIS817_TOUCH 0x0817 | 972 | #define USB_DEVICE_ID_SIS817_TOUCH 0x0817 |
965 | #define USB_DEVICE_ID_SIS_TS 0x1013 | 973 | #define USB_DEVICE_ID_SIS_TS 0x1013 |
966 | #define USB_DEVICE_ID_SIS1030_TOUCH 0x1030 | 974 | #define USB_DEVICE_ID_SIS1030_TOUCH 0x1030 |
975 | #define USB_DEVICE_ID_SIS10FB_TOUCH 0x10fb | ||
967 | 976 | ||
968 | #define USB_VENDOR_ID_SKYCABLE 0x1223 | 977 | #define USB_VENDOR_ID_SKYCABLE 0x1223 |
969 | #define USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER 0x3F07 | 978 | #define USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER 0x3F07 |
diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c index 1ac4ff4d57a6..643b6eb54442 100644 --- a/drivers/hid/hid-lenovo.c +++ b/drivers/hid/hid-lenovo.c | |||
@@ -6,6 +6,17 @@ | |||
6 | * | 6 | * |
7 | * Copyright (c) 2012 Bernhard Seibold | 7 | * Copyright (c) 2012 Bernhard Seibold |
8 | * Copyright (c) 2014 Jamie Lentin <jm@lentin.co.uk> | 8 | * Copyright (c) 2014 Jamie Lentin <jm@lentin.co.uk> |
9 | * | ||
10 | * Linux IBM/Lenovo Scrollpoint mouse driver: | ||
11 | * - IBM Scrollpoint III | ||
12 | * - IBM Scrollpoint Pro | ||
13 | * - IBM Scrollpoint Optical | ||
14 | * - IBM Scrollpoint Optical 800dpi | ||
15 | * - IBM Scrollpoint Optical 800dpi Pro | ||
16 | * - Lenovo Scrollpoint Optical | ||
17 | * | ||
18 | * Copyright (c) 2012 Peter De Wachter <pdewacht@gmail.com> | ||
19 | * Copyright (c) 2018 Peter Ganzhorn <peter.ganzhorn@gmail.com> | ||
9 | */ | 20 | */ |
10 | 21 | ||
11 | /* | 22 | /* |
@@ -160,6 +171,17 @@ static int lenovo_input_mapping_cptkbd(struct hid_device *hdev, | |||
160 | return 0; | 171 | return 0; |
161 | } | 172 | } |
162 | 173 | ||
174 | static int lenovo_input_mapping_scrollpoint(struct hid_device *hdev, | ||
175 | struct hid_input *hi, struct hid_field *field, | ||
176 | struct hid_usage *usage, unsigned long **bit, int *max) | ||
177 | { | ||
178 | if (usage->hid == HID_GD_Z) { | ||
179 | hid_map_usage(hi, usage, bit, max, EV_REL, REL_HWHEEL); | ||
180 | return 1; | ||
181 | } | ||
182 | return 0; | ||
183 | } | ||
184 | |||
163 | static int lenovo_input_mapping(struct hid_device *hdev, | 185 | static int lenovo_input_mapping(struct hid_device *hdev, |
164 | struct hid_input *hi, struct hid_field *field, | 186 | struct hid_input *hi, struct hid_field *field, |
165 | struct hid_usage *usage, unsigned long **bit, int *max) | 187 | struct hid_usage *usage, unsigned long **bit, int *max) |
@@ -172,6 +194,14 @@ static int lenovo_input_mapping(struct hid_device *hdev, | |||
172 | case USB_DEVICE_ID_LENOVO_CBTKBD: | 194 | case USB_DEVICE_ID_LENOVO_CBTKBD: |
173 | return lenovo_input_mapping_cptkbd(hdev, hi, field, | 195 | return lenovo_input_mapping_cptkbd(hdev, hi, field, |
174 | usage, bit, max); | 196 | usage, bit, max); |
197 | case USB_DEVICE_ID_IBM_SCROLLPOINT_III: | ||
198 | case USB_DEVICE_ID_IBM_SCROLLPOINT_PRO: | ||
199 | case USB_DEVICE_ID_IBM_SCROLLPOINT_OPTICAL: | ||
200 | case USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL: | ||
201 | case USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL_PRO: | ||
202 | case USB_DEVICE_ID_LENOVO_SCROLLPOINT_OPTICAL: | ||
203 | return lenovo_input_mapping_scrollpoint(hdev, hi, field, | ||
204 | usage, bit, max); | ||
175 | default: | 205 | default: |
176 | return 0; | 206 | return 0; |
177 | } | 207 | } |
@@ -883,6 +913,12 @@ static const struct hid_device_id lenovo_devices[] = { | |||
883 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) }, | 913 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) }, |
884 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CBTKBD) }, | 914 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CBTKBD) }, |
885 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPPRODOCK) }, | 915 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPPRODOCK) }, |
916 | { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_III) }, | ||
917 | { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_PRO) }, | ||
918 | { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_OPTICAL) }, | ||
919 | { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL) }, | ||
920 | { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL_PRO) }, | ||
921 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_SCROLLPOINT_OPTICAL) }, | ||
886 | { } | 922 | { } |
887 | }; | 923 | }; |
888 | 924 | ||
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c index 963328674e93..cc33622253aa 100644 --- a/drivers/hid/i2c-hid/i2c-hid.c +++ b/drivers/hid/i2c-hid/i2c-hid.c | |||
@@ -174,6 +174,8 @@ static const struct i2c_hid_quirks { | |||
174 | I2C_HID_QUIRK_NO_IRQ_AFTER_RESET }, | 174 | I2C_HID_QUIRK_NO_IRQ_AFTER_RESET }, |
175 | { I2C_VENDOR_ID_RAYD, I2C_PRODUCT_ID_RAYD_3118, | 175 | { I2C_VENDOR_ID_RAYD, I2C_PRODUCT_ID_RAYD_3118, |
176 | I2C_HID_QUIRK_RESEND_REPORT_DESCR }, | 176 | I2C_HID_QUIRK_RESEND_REPORT_DESCR }, |
177 | { USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS10FB_TOUCH, | ||
178 | I2C_HID_QUIRK_RESEND_REPORT_DESCR }, | ||
177 | { 0, 0 } | 179 | { 0, 0 } |
178 | }; | 180 | }; |
179 | 181 | ||
diff --git a/drivers/hid/intel-ish-hid/ishtp-hid-client.c b/drivers/hid/intel-ish-hid/ishtp-hid-client.c index 157b44aacdff..acc2536c8094 100644 --- a/drivers/hid/intel-ish-hid/ishtp-hid-client.c +++ b/drivers/hid/intel-ish-hid/ishtp-hid-client.c | |||
@@ -77,21 +77,21 @@ static void process_recv(struct ishtp_cl *hid_ishtp_cl, void *recv_buf, | |||
77 | struct ishtp_cl_data *client_data = hid_ishtp_cl->client_data; | 77 | struct ishtp_cl_data *client_data = hid_ishtp_cl->client_data; |
78 | int curr_hid_dev = client_data->cur_hid_dev; | 78 | int curr_hid_dev = client_data->cur_hid_dev; |
79 | 79 | ||
80 | if (data_len < sizeof(struct hostif_msg_hdr)) { | ||
81 | dev_err(&client_data->cl_device->dev, | ||
82 | "[hid-ish]: error, received %u which is less than data header %u\n", | ||
83 | (unsigned int)data_len, | ||
84 | (unsigned int)sizeof(struct hostif_msg_hdr)); | ||
85 | ++client_data->bad_recv_cnt; | ||
86 | ish_hw_reset(hid_ishtp_cl->dev); | ||
87 | return; | ||
88 | } | ||
89 | |||
90 | payload = recv_buf + sizeof(struct hostif_msg_hdr); | 80 | payload = recv_buf + sizeof(struct hostif_msg_hdr); |
91 | total_len = data_len; | 81 | total_len = data_len; |
92 | cur_pos = 0; | 82 | cur_pos = 0; |
93 | 83 | ||
94 | do { | 84 | do { |
85 | if (cur_pos + sizeof(struct hostif_msg) > total_len) { | ||
86 | dev_err(&client_data->cl_device->dev, | ||
87 | "[hid-ish]: error, received %u which is less than data header %u\n", | ||
88 | (unsigned int)data_len, | ||
89 | (unsigned int)sizeof(struct hostif_msg_hdr)); | ||
90 | ++client_data->bad_recv_cnt; | ||
91 | ish_hw_reset(hid_ishtp_cl->dev); | ||
92 | break; | ||
93 | } | ||
94 | |||
95 | recv_msg = (struct hostif_msg *)(recv_buf + cur_pos); | 95 | recv_msg = (struct hostif_msg *)(recv_buf + cur_pos); |
96 | payload_len = recv_msg->hdr.size; | 96 | payload_len = recv_msg->hdr.size; |
97 | 97 | ||
@@ -412,9 +412,7 @@ void hid_ishtp_get_report(struct hid_device *hid, int report_id, | |||
412 | { | 412 | { |
413 | struct ishtp_hid_data *hid_data = hid->driver_data; | 413 | struct ishtp_hid_data *hid_data = hid->driver_data; |
414 | struct ishtp_cl_data *client_data = hid_data->client_data; | 414 | struct ishtp_cl_data *client_data = hid_data->client_data; |
415 | static unsigned char buf[10]; | 415 | struct hostif_msg_to_sensor msg = {}; |
416 | unsigned int len; | ||
417 | struct hostif_msg_to_sensor *msg = (struct hostif_msg_to_sensor *)buf; | ||
418 | int rv; | 416 | int rv; |
419 | int i; | 417 | int i; |
420 | 418 | ||
@@ -426,14 +424,11 @@ void hid_ishtp_get_report(struct hid_device *hid, int report_id, | |||
426 | return; | 424 | return; |
427 | } | 425 | } |
428 | 426 | ||
429 | len = sizeof(struct hostif_msg_to_sensor); | 427 | msg.hdr.command = (report_type == HID_FEATURE_REPORT) ? |
430 | |||
431 | memset(msg, 0, sizeof(struct hostif_msg_to_sensor)); | ||
432 | msg->hdr.command = (report_type == HID_FEATURE_REPORT) ? | ||
433 | HOSTIF_GET_FEATURE_REPORT : HOSTIF_GET_INPUT_REPORT; | 428 | HOSTIF_GET_FEATURE_REPORT : HOSTIF_GET_INPUT_REPORT; |
434 | for (i = 0; i < client_data->num_hid_devices; ++i) { | 429 | for (i = 0; i < client_data->num_hid_devices; ++i) { |
435 | if (hid == client_data->hid_sensor_hubs[i]) { | 430 | if (hid == client_data->hid_sensor_hubs[i]) { |
436 | msg->hdr.device_id = | 431 | msg.hdr.device_id = |
437 | client_data->hid_devices[i].dev_id; | 432 | client_data->hid_devices[i].dev_id; |
438 | break; | 433 | break; |
439 | } | 434 | } |
@@ -442,8 +437,9 @@ void hid_ishtp_get_report(struct hid_device *hid, int report_id, | |||
442 | if (i == client_data->num_hid_devices) | 437 | if (i == client_data->num_hid_devices) |
443 | return; | 438 | return; |
444 | 439 | ||
445 | msg->report_id = report_id; | 440 | msg.report_id = report_id; |
446 | rv = ishtp_cl_send(client_data->hid_ishtp_cl, buf, len); | 441 | rv = ishtp_cl_send(client_data->hid_ishtp_cl, (uint8_t *)&msg, |
442 | sizeof(msg)); | ||
447 | if (rv) | 443 | if (rv) |
448 | hid_ishtp_trace(client_data, "%s hid %p send failed\n", | 444 | hid_ishtp_trace(client_data, "%s hid %p send failed\n", |
449 | __func__, hid); | 445 | __func__, hid); |
diff --git a/drivers/hid/intel-ish-hid/ishtp/bus.c b/drivers/hid/intel-ish-hid/ishtp/bus.c index f272cdd9bd55..2623a567ffba 100644 --- a/drivers/hid/intel-ish-hid/ishtp/bus.c +++ b/drivers/hid/intel-ish-hid/ishtp/bus.c | |||
@@ -418,7 +418,7 @@ static struct ishtp_cl_device *ishtp_bus_add_device(struct ishtp_device *dev, | |||
418 | list_del(&device->device_link); | 418 | list_del(&device->device_link); |
419 | spin_unlock_irqrestore(&dev->device_list_lock, flags); | 419 | spin_unlock_irqrestore(&dev->device_list_lock, flags); |
420 | dev_err(dev->devc, "Failed to register ISHTP client device\n"); | 420 | dev_err(dev->devc, "Failed to register ISHTP client device\n"); |
421 | kfree(device); | 421 | put_device(&device->dev); |
422 | return NULL; | 422 | return NULL; |
423 | } | 423 | } |
424 | 424 | ||
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index b54ef1ffcbec..ee7a37eb159a 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c | |||
@@ -1213,8 +1213,10 @@ static int __wacom_devm_sysfs_create_group(struct wacom *wacom, | |||
1213 | devres->root = root; | 1213 | devres->root = root; |
1214 | 1214 | ||
1215 | error = sysfs_create_group(devres->root, group); | 1215 | error = sysfs_create_group(devres->root, group); |
1216 | if (error) | 1216 | if (error) { |
1217 | devres_free(devres); | ||
1217 | return error; | 1218 | return error; |
1219 | } | ||
1218 | 1220 | ||
1219 | devres_add(&wacom->hdev->dev, devres); | 1221 | devres_add(&wacom->hdev->dev, devres); |
1220 | 1222 | ||