Skip to content

Commit a9d0683

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: - regression fix (missing IRQs) for devices that require 'always poll' quirk, from Dmitry Torokhov - new device ID addition to Ortek driver, from Benjamin Tissoires * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: HID: ortek: add one more buggy device HID: usbhid: fix "always poll" quirk
2 parents eeb7c41 + c228352 commit a9d0683

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

drivers/hid/hid-core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2216,6 +2216,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
22162216
#if IS_ENABLED(CONFIG_HID_ORTEK)
22172217
{ HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) },
22182218
{ HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) },
2219+
{ HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_IHOME_IMAC_A210S) },
22192220
{ HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) },
22202221
#endif
22212222
#if IS_ENABLED(CONFIG_HID_PANTHERLORD)

drivers/hid/hid-ids.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,7 @@
824824
#define USB_VENDOR_ID_ORTEK 0x05a4
825825
#define USB_DEVICE_ID_ORTEK_PKB1700 0x1700
826826
#define USB_DEVICE_ID_ORTEK_WKB2000 0x2000
827+
#define USB_DEVICE_ID_ORTEK_IHOME_IMAC_A210S 0x8003
827828

828829
#define USB_VENDOR_ID_PLANTRONICS 0x047f
829830

drivers/hid/hid-ortek.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*
66
* Ortek PKB-1700
77
* Ortek WKB-2000
8+
* iHome IMAC-A210S
89
* Skycable wireless presenter
910
*
1011
* Copyright (c) 2010 Johnathon Harris <[email protected]>
@@ -28,10 +29,10 @@ static __u8 *ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
2829
unsigned int *rsize)
2930
{
3031
if (*rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) {
31-
hid_info(hdev, "Fixing up logical minimum in report descriptor (Ortek)\n");
32+
hid_info(hdev, "Fixing up logical maximum in report descriptor (Ortek)\n");
3233
rdesc[55] = 0x92;
3334
} else if (*rsize >= 54 && rdesc[52] == 0x25 && rdesc[53] == 0x01) {
34-
hid_info(hdev, "Fixing up logical minimum in report descriptor (Skycable)\n");
35+
hid_info(hdev, "Fixing up logical maximum in report descriptor (Skycable)\n");
3536
rdesc[53] = 0x65;
3637
}
3738
return rdesc;
@@ -40,6 +41,7 @@ static __u8 *ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
4041
static const struct hid_device_id ortek_devices[] = {
4142
{ HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) },
4243
{ HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) },
44+
{ HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_IHOME_IMAC_A210S) },
4345
{ HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) },
4446
{ }
4547
};

drivers/hid/usbhid/hid-core.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -680,18 +680,21 @@ static int usbhid_open(struct hid_device *hid)
680680
struct usbhid_device *usbhid = hid->driver_data;
681681
int res;
682682

683+
set_bit(HID_OPENED, &usbhid->iofl);
684+
683685
if (hid->quirks & HID_QUIRK_ALWAYS_POLL)
684686
return 0;
685687

686688
res = usb_autopm_get_interface(usbhid->intf);
687689
/* the device must be awake to reliably request remote wakeup */
688-
if (res < 0)
690+
if (res < 0) {
691+
clear_bit(HID_OPENED, &usbhid->iofl);
689692
return -EIO;
693+
}
690694

691695
usbhid->intf->needs_remote_wakeup = 1;
692696

693697
set_bit(HID_RESUME_RUNNING, &usbhid->iofl);
694-
set_bit(HID_OPENED, &usbhid->iofl);
695698
set_bit(HID_IN_POLLING, &usbhid->iofl);
696699

697700
res = hid_start_in(hid);
@@ -727,19 +730,20 @@ static void usbhid_close(struct hid_device *hid)
727730
{
728731
struct usbhid_device *usbhid = hid->driver_data;
729732

730-
if (hid->quirks & HID_QUIRK_ALWAYS_POLL)
731-
return;
732-
733733
/*
734734
* Make sure we don't restart data acquisition due to
735735
* a resumption we no longer care about by avoiding racing
736736
* with hid_start_in().
737737
*/
738738
spin_lock_irq(&usbhid->lock);
739-
clear_bit(HID_IN_POLLING, &usbhid->iofl);
740739
clear_bit(HID_OPENED, &usbhid->iofl);
740+
if (!(hid->quirks & HID_QUIRK_ALWAYS_POLL))
741+
clear_bit(HID_IN_POLLING, &usbhid->iofl);
741742
spin_unlock_irq(&usbhid->lock);
742743

744+
if (hid->quirks & HID_QUIRK_ALWAYS_POLL)
745+
return;
746+
743747
hid_cancel_delayed_stuff(usbhid);
744748
usb_kill_urb(usbhid->urbin);
745749
usbhid->intf->needs_remote_wakeup = 0;

0 commit comments

Comments
 (0)