Skip to content

Commit ecb4d52

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID fixes from Jiri Kosina: - hid.git is moving towards group maintainership (where group is myself and Benjamin Tissoires), therefore this pull request updates MAINTAINERS accordingly - fix for hid-asus config dependency from Arnd Bergmann - two device-specific quirks for i2c-hid from Julian Sax and Kai-Heng Feng - other few small assorted fixes * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: HID: fix up .raw_event() documentation HID: asus: fix build warning wiht CONFIG_ASUS_WMI disabled HID: i2c-hid: add Direkt-Tek DTLAPY133-1 to descriptor override HID: moving to group maintainership model HID: alps: allow incoming reports when only the trackstick is opened Revert "HID: add NOGET quirk for Eaton Ellipse MAX UPS" HID: i2c-hid: Add a small delay after sleep command for Raydium touchpanel HID: hiddev: fix potential Spectre v1
2 parents 8053e5b + aa9b760 commit ecb4d52

File tree

9 files changed

+71
-11
lines changed

9 files changed

+71
-11
lines changed

MAINTAINERS

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6607,9 +6607,9 @@ F: arch/*/include/asm/suspend*.h
66076607

66086608
HID CORE LAYER
66096609
M: Jiri Kosina <jikos@kernel.org>
6610-
R: Benjamin Tissoires <benjamin.tissoires@redhat.com>
6610+
M: Benjamin Tissoires <benjamin.tissoires@redhat.com>
66116611
L: linux-input@vger.kernel.org
6612-
T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git
6612+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
66136613
S: Maintained
66146614
F: drivers/hid/
66156615
F: include/linux/hid*
@@ -15436,9 +15436,9 @@ F: include/linux/usb/gadget*
1543615436

1543715437
USB HID/HIDBP DRIVERS (USB KEYBOARDS, MICE, REMOTE CONTROLS, ...)
1543815438
M: Jiri Kosina <jikos@kernel.org>
15439-
R: Benjamin Tissoires <benjamin.tissoires@redhat.com>
15439+
M: Benjamin Tissoires <benjamin.tissoires@redhat.com>
1544015440
L: linux-usb@vger.kernel.org
15441-
T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git
15441+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
1544215442
S: Maintained
1544315443
F: Documentation/hid/hiddev.txt
1544415444
F: drivers/hid/usbhid/

drivers/hid/hid-alps.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,20 @@ static int T4_init(struct hid_device *hdev, struct alps_dev *pri_data)
660660
return ret;
661661
}
662662

663+
static int alps_sp_open(struct input_dev *dev)
664+
{
665+
struct hid_device *hid = input_get_drvdata(dev);
666+
667+
return hid_hw_open(hid);
668+
}
669+
670+
static void alps_sp_close(struct input_dev *dev)
671+
{
672+
struct hid_device *hid = input_get_drvdata(dev);
673+
674+
hid_hw_close(hid);
675+
}
676+
663677
static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi)
664678
{
665679
struct alps_dev *data = hid_get_drvdata(hdev);
@@ -733,6 +747,10 @@ static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi)
733747
input2->id.version = input->id.version;
734748
input2->dev.parent = input->dev.parent;
735749

750+
input_set_drvdata(input2, hdev);
751+
input2->open = alps_sp_open;
752+
input2->close = alps_sp_close;
753+
736754
__set_bit(EV_KEY, input2->evbit);
737755
data->sp_btn_cnt = (data->sp_btn_info & 0x0F);
738756
for (i = 0; i < data->sp_btn_cnt; i++)

drivers/hid/hid-asus.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,9 @@ static bool asus_kbd_wmi_led_control_present(struct hid_device *hdev)
359359
u32 value;
360360
int ret;
361361

362+
if (!IS_ENABLED(CONFIG_ASUS_WMI))
363+
return false;
364+
362365
ret = asus_wmi_evaluate_method(ASUS_WMI_METHODID_DSTS2,
363366
ASUS_WMI_DEVID_KBD_BACKLIGHT, 0, &value);
364367
hid_dbg(hdev, "WMI backlight check: rc %d value %x", ret, value);

drivers/hid/hid-ids.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,9 @@
927927
#define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3003 0x3003
928928
#define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008 0x3008
929929

930+
#define I2C_VENDOR_ID_RAYDIUM 0x2386
931+
#define I2C_PRODUCT_ID_RAYDIUM_4B33 0x4b33
932+
930933
#define USB_VENDOR_ID_RAZER 0x1532
931934
#define USB_DEVICE_ID_RAZER_BLADE_14 0x011D
932935

drivers/hid/hid-quirks.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ static const struct hid_device_id hid_quirks[] = {
107107
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C05A), HID_QUIRK_ALWAYS_POLL },
108108
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C06A), HID_QUIRK_ALWAYS_POLL },
109109
{ HID_USB_DEVICE(USB_VENDOR_ID_MCS, USB_DEVICE_ID_MCS_GAMEPADBLOCK), HID_QUIRK_MULTI_INPUT },
110-
{ HID_USB_DEVICE(USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS), HID_QUIRK_NOGET },
111110
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER), HID_QUIRK_NO_INIT_REPORTS },
112111
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_SURFACE_PRO_2), HID_QUIRK_NO_INIT_REPORTS },
113112
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TOUCH_COVER_2), HID_QUIRK_NO_INIT_REPORTS },

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#define I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV BIT(0)
5050
#define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET BIT(1)
5151
#define I2C_HID_QUIRK_NO_RUNTIME_PM BIT(2)
52+
#define I2C_HID_QUIRK_DELAY_AFTER_SLEEP BIT(3)
5253

5354
/* flags */
5455
#define I2C_HID_STARTED 0
@@ -158,6 +159,8 @@ struct i2c_hid {
158159

159160
bool irq_wake_enabled;
160161
struct mutex reset_lock;
162+
163+
unsigned long sleep_delay;
161164
};
162165

163166
static const struct i2c_hid_quirks {
@@ -172,6 +175,8 @@ static const struct i2c_hid_quirks {
172175
{ I2C_VENDOR_ID_HANTICK, I2C_PRODUCT_ID_HANTICK_5288,
173176
I2C_HID_QUIRK_NO_IRQ_AFTER_RESET |
174177
I2C_HID_QUIRK_NO_RUNTIME_PM },
178+
{ I2C_VENDOR_ID_RAYDIUM, I2C_PRODUCT_ID_RAYDIUM_4B33,
179+
I2C_HID_QUIRK_DELAY_AFTER_SLEEP },
175180
{ 0, 0 }
176181
};
177182

@@ -387,6 +392,7 @@ static int i2c_hid_set_power(struct i2c_client *client, int power_state)
387392
{
388393
struct i2c_hid *ihid = i2c_get_clientdata(client);
389394
int ret;
395+
unsigned long now, delay;
390396

391397
i2c_hid_dbg(ihid, "%s\n", __func__);
392398

@@ -404,9 +410,22 @@ static int i2c_hid_set_power(struct i2c_client *client, int power_state)
404410
goto set_pwr_exit;
405411
}
406412

413+
if (ihid->quirks & I2C_HID_QUIRK_DELAY_AFTER_SLEEP &&
414+
power_state == I2C_HID_PWR_ON) {
415+
now = jiffies;
416+
if (time_after(ihid->sleep_delay, now)) {
417+
delay = jiffies_to_usecs(ihid->sleep_delay - now);
418+
usleep_range(delay, delay + 1);
419+
}
420+
}
421+
407422
ret = __i2c_hid_command(client, &hid_set_power_cmd, power_state,
408423
0, NULL, 0, NULL, 0);
409424

425+
if (ihid->quirks & I2C_HID_QUIRK_DELAY_AFTER_SLEEP &&
426+
power_state == I2C_HID_PWR_SLEEP)
427+
ihid->sleep_delay = jiffies + msecs_to_jiffies(20);
428+
410429
if (ret)
411430
dev_err(&client->dev, "failed to change power setting.\n");
412431

drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,14 @@ static const struct dmi_system_id i2c_hid_dmi_desc_override_table[] = {
330330
},
331331
.driver_data = (void *)&sipodev_desc
332332
},
333+
{
334+
.ident = "Direkt-Tek DTLAPY133-1",
335+
.matches = {
336+
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Direkt-Tek"),
337+
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "DTLAPY133-1"),
338+
},
339+
.driver_data = (void *)&sipodev_desc
340+
},
333341
{
334342
.ident = "Mediacom Flexbook Edge 11",
335343
.matches = {

drivers/hid/usbhid/hiddev.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -512,14 +512,24 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,
512512
if (cmd == HIDIOCGCOLLECTIONINDEX) {
513513
if (uref->usage_index >= field->maxusage)
514514
goto inval;
515+
uref->usage_index =
516+
array_index_nospec(uref->usage_index,
517+
field->maxusage);
515518
} else if (uref->usage_index >= field->report_count)
516519
goto inval;
517520
}
518521

519-
if ((cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) &&
520-
(uref_multi->num_values > HID_MAX_MULTI_USAGES ||
521-
uref->usage_index + uref_multi->num_values > field->report_count))
522-
goto inval;
522+
if (cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) {
523+
if (uref_multi->num_values > HID_MAX_MULTI_USAGES ||
524+
uref->usage_index + uref_multi->num_values >
525+
field->report_count)
526+
goto inval;
527+
528+
uref->usage_index =
529+
array_index_nospec(uref->usage_index,
530+
field->report_count -
531+
uref_multi->num_values);
532+
}
523533

524534
switch (cmd) {
525535
case HIDIOCGUSAGE:

include/linux/hid.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,8 +722,8 @@ struct hid_usage_id {
722722
* input will not be passed to raw_event unless hid_device_io_start is
723723
* called.
724724
*
725-
* raw_event and event should return 0 on no action performed, 1 when no
726-
* further processing should be done and negative on error
725+
* raw_event and event should return negative on error, any other value will
726+
* pass the event on to .event() typically return 0 for success.
727727
*
728728
* input_mapping shall return a negative value to completely ignore this usage
729729
* (e.g. doubled or invalid usage), zero to continue with parsing of this

0 commit comments

Comments
 (0)