Skip to content

Commit ce19275

Browse files
committed
Merge tag 'for-linus-2022120801' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID fixes from Jiri Kosina: "A regression fix for handling Logitech HID++ devices and memory corruption fixes: - regression fix (revert) for catch-all handling of Logitech HID++ Bluetooth devices; there are devices that turn out not to work with this, and the root cause is yet to be properly understood. So we are dropping it for now, and it will be revisited for 6.2 or 6.3 (Benjamin Tissoires) - memory corruption fix in HID core (ZhangPeng) - memory corruption fix in hid-lg4ff (Anastasia Belova) - Kconfig fix for I2C_HID (Benjamin Tissoires) - a few device-id specific quirks that piggy-back on top of the important fixes above" * tag 'for-linus-2022120801' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: Revert "HID: logitech-hidpp: Enable HID++ for all the Logitech Bluetooth devices" Revert "HID: logitech-hidpp: Remove special-casing of Bluetooth devices" HID: usbhid: Add ALWAYS_POLL quirk for some mice HID: core: fix shift-out-of-bounds in hid_report_raw_event HID: uclogic: Add HID_QUIRK_HIDINPUT_FORCE quirk HID: fix I2C_HID not selected when I2C_HID_OF_ELAN is HID: hid-lg4ff: Add check for empty lbuf HID: ite: Enable QUIRK_TOUCHPAD_ON_OFF_REPORT on Acer Aspire Switch V 10 HID: uclogic: Fix frame templates for big endian architectures
2 parents f3e8416 + a9d9e46 commit ce19275

File tree

9 files changed

+34
-22
lines changed

9 files changed

+34
-22
lines changed

drivers/hid/hid-core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,6 +1315,9 @@ static s32 snto32(__u32 value, unsigned n)
13151315
if (!value || !n)
13161316
return 0;
13171317

1318+
if (n > 32)
1319+
n = 32;
1320+
13181321
switch (n) {
13191322
case 8: return ((__s8)value);
13201323
case 16: return ((__s16)value);

drivers/hid/hid-ids.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@
274274
#define USB_DEVICE_ID_CH_AXIS_295 0x001c
275275

276276
#define USB_VENDOR_ID_CHERRY 0x046a
277+
#define USB_DEVICE_ID_CHERRY_MOUSE_000C 0x000c
277278
#define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023
278279
#define USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR 0x0027
279280

@@ -917,6 +918,7 @@
917918
#define USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER 0x02fd
918919
#define USB_DEVICE_ID_MS_PIXART_MOUSE 0x00cb
919920
#define USB_DEVICE_ID_8BITDO_SN30_PRO_PLUS 0x02e0
921+
#define USB_DEVICE_ID_MS_MOUSE_0783 0x0783
920922

921923
#define USB_VENDOR_ID_MOJO 0x8282
922924
#define USB_DEVICE_ID_RETRO_ADAPTER 0x3201
@@ -1215,6 +1217,7 @@
12151217
#define USB_DEVICE_ID_SYNAPTICS_DELL_K15A 0x6e21
12161218
#define USB_DEVICE_ID_SYNAPTICS_ACER_ONE_S1002 0x73f4
12171219
#define USB_DEVICE_ID_SYNAPTICS_ACER_ONE_S1003 0x73f5
1220+
#define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_017 0x73f6
12181221
#define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5 0x81a7
12191222

12201223
#define USB_VENDOR_ID_TEXAS_INSTRUMENTS 0x2047
@@ -1381,6 +1384,7 @@
13811384

13821385
#define USB_VENDOR_ID_PRIMAX 0x0461
13831386
#define USB_DEVICE_ID_PRIMAX_MOUSE_4D22 0x4d22
1387+
#define USB_DEVICE_ID_PRIMAX_MOUSE_4E2A 0x4e2a
13841388
#define USB_DEVICE_ID_PRIMAX_KEYBOARD 0x4e05
13851389
#define USB_DEVICE_ID_PRIMAX_REZEL 0x4e72
13861390
#define USB_DEVICE_ID_PRIMAX_PIXART_MOUSE_4D0F 0x4d0f

drivers/hid/hid-ite.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ static const struct hid_device_id ite_devices[] = {
121121
USB_VENDOR_ID_SYNAPTICS,
122122
USB_DEVICE_ID_SYNAPTICS_ACER_ONE_S1003),
123123
.driver_data = QUIRK_TOUCHPAD_ON_OFF_REPORT },
124+
/* ITE8910 USB kbd ctlr, with Synaptics touchpad connected to it. */
125+
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
126+
USB_VENDOR_ID_SYNAPTICS,
127+
USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_017),
128+
.driver_data = QUIRK_TOUCHPAD_ON_OFF_REPORT },
124129
{ }
125130
};
126131
MODULE_DEVICE_TABLE(hid, ite_devices);

drivers/hid/hid-lg4ff.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,12 @@ static ssize_t lg4ff_alternate_modes_store(struct device *dev, struct device_att
872872
return -ENOMEM;
873873

874874
i = strlen(lbuf);
875+
876+
if (i == 0) {
877+
kfree(lbuf);
878+
return -EINVAL;
879+
}
880+
875881
if (lbuf[i-1] == '\n') {
876882
if (i == 1) {
877883
kfree(lbuf);

drivers/hid/hid-logitech-hidpp.c

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4269,21 +4269,6 @@ static void hidpp_remove(struct hid_device *hdev)
42694269
mutex_destroy(&hidpp->send_mutex);
42704270
}
42714271

4272-
static const struct hid_device_id unhandled_hidpp_devices[] = {
4273-
/* Logitech Harmony Adapter for PS3, handled in hid-sony */
4274-
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_PS3) },
4275-
/* Handled in hid-generic */
4276-
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DINOVO_EDGE_KBD) },
4277-
{}
4278-
};
4279-
4280-
static bool hidpp_match(struct hid_device *hdev,
4281-
bool ignore_special_driver)
4282-
{
4283-
/* Refuse to handle devices handled by other HID drivers */
4284-
return !hid_match_id(hdev, unhandled_hidpp_devices);
4285-
}
4286-
42874272
#define LDJ_DEVICE(product) \
42884273
HID_DEVICE(BUS_USB, HID_GROUP_LOGITECH_DJ_DEVICE, \
42894274
USB_VENDOR_ID_LOGITECH, (product))
@@ -4367,9 +4352,15 @@ static const struct hid_device_id hidpp_devices[] = {
43674352
{ /* MX5500 keyboard over Bluetooth */
43684353
HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb30b),
43694354
.driver_data = HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS },
4370-
4371-
{ /* And try to enable HID++ for all the Logitech Bluetooth devices */
4372-
HID_DEVICE(BUS_BLUETOOTH, HID_GROUP_ANY, USB_VENDOR_ID_LOGITECH, HID_ANY_ID) },
4355+
{ /* M-RCQ142 V470 Cordless Laser Mouse over Bluetooth */
4356+
HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb008) },
4357+
{ /* MX Master mouse over Bluetooth */
4358+
HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb012) },
4359+
{ /* MX Ergo trackball over Bluetooth */
4360+
HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb01d) },
4361+
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb01e) },
4362+
{ /* MX Master 3 mouse over Bluetooth */
4363+
HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb023) },
43734364
{}
43744365
};
43754366

@@ -4383,7 +4374,6 @@ static const struct hid_usage_id hidpp_usages[] = {
43834374
static struct hid_driver hidpp_driver = {
43844375
.name = "logitech-hidpp-device",
43854376
.id_table = hidpp_devices,
4386-
.match = hidpp_match,
43874377
.report_fixup = hidpp_report_fixup,
43884378
.probe = hidpp_probe,
43894379
.remove = hidpp_remove,

drivers/hid/hid-quirks.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ static const struct hid_device_id hid_quirks[] = {
5454
{ HID_USB_DEVICE(USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_YOKE), HID_QUIRK_NOGET },
5555
{ HID_USB_DEVICE(USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_PRO_PEDALS), HID_QUIRK_NOGET },
5656
{ HID_USB_DEVICE(USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_PRO_THROTTLE), HID_QUIRK_NOGET },
57+
{ HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_MOUSE_000C), HID_QUIRK_ALWAYS_POLL },
5758
{ HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K65RGB), HID_QUIRK_NO_INIT_REPORTS },
5859
{ HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K65RGB_RAPIDFIRE), HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL },
5960
{ HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K70RGB), HID_QUIRK_NO_INIT_REPORTS },
@@ -122,6 +123,7 @@ static const struct hid_device_id hid_quirks[] = {
122123
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C05A), HID_QUIRK_ALWAYS_POLL },
123124
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C06A), HID_QUIRK_ALWAYS_POLL },
124125
{ HID_USB_DEVICE(USB_VENDOR_ID_MCS, USB_DEVICE_ID_MCS_GAMEPADBLOCK), HID_QUIRK_MULTI_INPUT },
126+
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_MOUSE_0783), HID_QUIRK_ALWAYS_POLL },
125127
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PIXART_MOUSE), HID_QUIRK_ALWAYS_POLL },
126128
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER), HID_QUIRK_NO_INIT_REPORTS },
127129
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_SURFACE3_COVER), HID_QUIRK_NO_INIT_REPORTS },
@@ -146,6 +148,7 @@ static const struct hid_device_id hid_quirks[] = {
146148
{ HID_USB_DEVICE(USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN), HID_QUIRK_NO_INIT_REPORTS },
147149
{ HID_USB_DEVICE(USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE), HID_QUIRK_ALWAYS_POLL },
148150
{ HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_MOUSE_4D22), HID_QUIRK_ALWAYS_POLL },
151+
{ HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_MOUSE_4E2A), HID_QUIRK_ALWAYS_POLL },
149152
{ HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_PIXART_MOUSE_4D0F), HID_QUIRK_ALWAYS_POLL },
150153
{ HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_PIXART_MOUSE_4D65), HID_QUIRK_ALWAYS_POLL },
151154
{ HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_PIXART_MOUSE_4E22), HID_QUIRK_ALWAYS_POLL },

drivers/hid/hid-uclogic-core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ static int uclogic_probe(struct hid_device *hdev,
192192
* than the pen, so use QUIRK_MULTI_INPUT for all tablets.
193193
*/
194194
hdev->quirks |= HID_QUIRK_MULTI_INPUT;
195+
hdev->quirks |= HID_QUIRK_HIDINPUT_FORCE;
195196

196197
/* Allocate and assign driver data */
197198
drvdata = devm_kzalloc(&hdev->dev, sizeof(*drvdata), GFP_KERNEL);

drivers/hid/hid-uclogic-rdesc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,7 @@ __u8 *uclogic_rdesc_template_apply(const __u8 *template_ptr,
11931193
p[sizeof(btn_head)] < param_num) {
11941194
v = param_list[p[sizeof(btn_head)]];
11951195
put_unaligned((__u8)0x2A, p); /* Usage Maximum */
1196-
put_unaligned_le16((__force u16)cpu_to_le16(v), p + 1);
1196+
put_unaligned((__force u16)cpu_to_le16(v), (s16 *)(p + 1));
11971197
p += sizeof(btn_head) + 1;
11981198
} else {
11991199
p++;

drivers/hid/i2c-hid/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,6 @@ endmenu
6666

6767
config I2C_HID_CORE
6868
tristate
69-
default y if I2C_HID_ACPI=y || I2C_HID_OF=y || I2C_HID_OF_GOODIX=y
70-
default m if I2C_HID_ACPI=m || I2C_HID_OF=m || I2C_HID_OF_GOODIX=m
69+
default y if I2C_HID_ACPI=y || I2C_HID_OF=y || I2C_HID_OF_ELAN=y || I2C_HID_OF_GOODIX=y
70+
default m if I2C_HID_ACPI=m || I2C_HID_OF=m || I2C_HID_OF_ELAN=m || I2C_HID_OF_GOODIX=m
7171
select HID

0 commit comments

Comments
 (0)