Skip to content

Commit 008464a

Browse files
committed
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
2 parents 036db8b + 070b963 commit 008464a

File tree

7 files changed

+71
-25
lines changed

7 files changed

+71
-25
lines changed

drivers/hid/Kconfig

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,11 @@ config HID_LENOVO
462462
select NEW_LEDS
463463
select LEDS_CLASS
464464
---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.
466466

467-
Say Y if you want support for the non-compliant features of the Lenovo
468-
Thinkpad standalone keyboards, e.g:
467+
Say Y if you want support for horizontal scrolling of the IBM/Lenovo
468+
Scrollpoint mice or the non-compliant features of the Lenovo Thinkpad
469+
standalone keyboards, e.g:
469470
- ThinkPad USB Keyboard with TrackPoint (supports extra LEDs and trackpoint
470471
configuration)
471472
- ThinkPad Compact Bluetooth Keyboard with TrackPoint (supports Fn keys)

drivers/hid/hid-ids.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,13 @@
552552
#define USB_VENDOR_ID_HUION 0x256c
553553
#define USB_DEVICE_ID_HUION_TABLET 0x006e
554554

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+
555562
#define USB_VENDOR_ID_IDEACOM 0x1cb6
556563
#define USB_DEVICE_ID_IDEACOM_IDC6650 0x6650
557564
#define USB_DEVICE_ID_IDEACOM_IDC6651 0x6651
@@ -684,6 +691,7 @@
684691
#define USB_DEVICE_ID_LENOVO_TPKBD 0x6009
685692
#define USB_DEVICE_ID_LENOVO_CUSBKBD 0x6047
686693
#define USB_DEVICE_ID_LENOVO_CBTKBD 0x6048
694+
#define USB_DEVICE_ID_LENOVO_SCROLLPOINT_OPTICAL 0x6049
687695
#define USB_DEVICE_ID_LENOVO_TPPRODOCK 0x6067
688696
#define USB_DEVICE_ID_LENOVO_X1_COVER 0x6085
689697
#define USB_DEVICE_ID_LENOVO_X1_TAB 0x60a3
@@ -964,6 +972,7 @@
964972
#define USB_DEVICE_ID_SIS817_TOUCH 0x0817
965973
#define USB_DEVICE_ID_SIS_TS 0x1013
966974
#define USB_DEVICE_ID_SIS1030_TOUCH 0x1030
975+
#define USB_DEVICE_ID_SIS10FB_TOUCH 0x10fb
967976

968977
#define USB_VENDOR_ID_SKYCABLE 0x1223
969978
#define USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER 0x3F07

drivers/hid/hid-lenovo.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@
66
*
77
* Copyright (c) 2012 Bernhard Seibold
88
* Copyright (c) 2014 Jamie Lentin <[email protected]>
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 <[email protected]>
19+
* Copyright (c) 2018 Peter Ganzhorn <[email protected]>
920
*/
1021

1122
/*
@@ -160,6 +171,17 @@ static int lenovo_input_mapping_cptkbd(struct hid_device *hdev,
160171
return 0;
161172
}
162173

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+
163185
static int lenovo_input_mapping(struct hid_device *hdev,
164186
struct hid_input *hi, struct hid_field *field,
165187
struct hid_usage *usage, unsigned long **bit, int *max)
@@ -172,6 +194,14 @@ static int lenovo_input_mapping(struct hid_device *hdev,
172194
case USB_DEVICE_ID_LENOVO_CBTKBD:
173195
return lenovo_input_mapping_cptkbd(hdev, hi, field,
174196
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);
175205
default:
176206
return 0;
177207
}
@@ -883,6 +913,12 @@ static const struct hid_device_id lenovo_devices[] = {
883913
{ HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) },
884914
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CBTKBD) },
885915
{ 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) },
886922
{ }
887923
};
888924

drivers/hid/i2c-hid/i2c-hid.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ static const struct i2c_hid_quirks {
174174
I2C_HID_QUIRK_NO_IRQ_AFTER_RESET },
175175
{ I2C_VENDOR_ID_RAYD, I2C_PRODUCT_ID_RAYD_3118,
176176
I2C_HID_QUIRK_RESEND_REPORT_DESCR },
177+
{ USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS10FB_TOUCH,
178+
I2C_HID_QUIRK_RESEND_REPORT_DESCR },
177179
{ 0, 0 }
178180
};
179181

drivers/hid/intel-ish-hid/ishtp-hid-client.c

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,21 @@ static void process_recv(struct ishtp_cl *hid_ishtp_cl, void *recv_buf,
7777
struct ishtp_cl_data *client_data = hid_ishtp_cl->client_data;
7878
int curr_hid_dev = client_data->cur_hid_dev;
7979

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-
9080
payload = recv_buf + sizeof(struct hostif_msg_hdr);
9181
total_len = data_len;
9282
cur_pos = 0;
9383

9484
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+
9595
recv_msg = (struct hostif_msg *)(recv_buf + cur_pos);
9696
payload_len = recv_msg->hdr.size;
9797

@@ -412,9 +412,7 @@ void hid_ishtp_get_report(struct hid_device *hid, int report_id,
412412
{
413413
struct ishtp_hid_data *hid_data = hid->driver_data;
414414
struct ishtp_cl_data *client_data = hid_data->client_data;
415-
static unsigned char buf[10];
416-
unsigned int len;
417-
struct hostif_msg_to_sensor *msg = (struct hostif_msg_to_sensor *)buf;
415+
struct hostif_msg_to_sensor msg = {};
418416
int rv;
419417
int i;
420418

@@ -426,14 +424,11 @@ void hid_ishtp_get_report(struct hid_device *hid, int report_id,
426424
return;
427425
}
428426

429-
len = sizeof(struct hostif_msg_to_sensor);
430-
431-
memset(msg, 0, sizeof(struct hostif_msg_to_sensor));
432-
msg->hdr.command = (report_type == HID_FEATURE_REPORT) ?
427+
msg.hdr.command = (report_type == HID_FEATURE_REPORT) ?
433428
HOSTIF_GET_FEATURE_REPORT : HOSTIF_GET_INPUT_REPORT;
434429
for (i = 0; i < client_data->num_hid_devices; ++i) {
435430
if (hid == client_data->hid_sensor_hubs[i]) {
436-
msg->hdr.device_id =
431+
msg.hdr.device_id =
437432
client_data->hid_devices[i].dev_id;
438433
break;
439434
}
@@ -442,8 +437,9 @@ void hid_ishtp_get_report(struct hid_device *hid, int report_id,
442437
if (i == client_data->num_hid_devices)
443438
return;
444439

445-
msg->report_id = report_id;
446-
rv = ishtp_cl_send(client_data->hid_ishtp_cl, buf, len);
440+
msg.report_id = report_id;
441+
rv = ishtp_cl_send(client_data->hid_ishtp_cl, (uint8_t *)&msg,
442+
sizeof(msg));
447443
if (rv)
448444
hid_ishtp_trace(client_data, "%s hid %p send failed\n",
449445
__func__, hid);

drivers/hid/intel-ish-hid/ishtp/bus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ static struct ishtp_cl_device *ishtp_bus_add_device(struct ishtp_device *dev,
418418
list_del(&device->device_link);
419419
spin_unlock_irqrestore(&dev->device_list_lock, flags);
420420
dev_err(dev->devc, "Failed to register ISHTP client device\n");
421-
kfree(device);
421+
put_device(&device->dev);
422422
return NULL;
423423
}
424424

drivers/hid/wacom_sys.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1213,8 +1213,10 @@ static int __wacom_devm_sysfs_create_group(struct wacom *wacom,
12131213
devres->root = root;
12141214

12151215
error = sysfs_create_group(devres->root, group);
1216-
if (error)
1216+
if (error) {
1217+
devres_free(devres);
12171218
return error;
1219+
}
12181220

12191221
devres_add(&wacom->hdev->dev, devres);
12201222

0 commit comments

Comments
 (0)