Skip to contentSkip to conversation

USB: yurex: recognize GeneralKeys wireless presenter as generic HID (Re: New: 2.6.37 breaks USB wireless presenter HID device)

PATCH In review Tomoki Sekiyama 2 participants 3 messages Jan 20, 2011 – Mar 3, 2011 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]/

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

PATCH 1/1 USB: yurex: recognize GeneralKeys wireless presenter as generic HID (Re: New: 2.6.37 breaks USB wireless presenter HID device)

Quoted 6 lines · Andrew Morton
Quoted 1 line · On Mon, 17 Jan 2011 10:53:51 GMT [email protected] wrote:

https://bugzilla.kernel.org/show_bug.cgi?id=26922

2.6.36->2.6.37 USB regression, bisected to "USB: add driver for Meywa-Denki& Kayac YUREX"

Unfortunately, the device seems to have the same Vendor ID and Product ID as YUREX leg-shakes sensors, and the commit 6bc235a2e2 added the ID to hid_ignore_list.

I believe that we can distinguish YUREX and the Wireless Presenter by device type. The patch below makes the driver ignore only YUREX (bInterfaceProtocol==0), and recognize Wireless Presenter (bInterfaceProtocol is keyboard or mouse) as generic HID. (I don't have the Wireless Presenter, so not yet ested.)

** YUREX lsusb information:
Bus 002 Device 007: ID 0c45:1010 Microdia
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10

  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x0c45 Microdia
  idProduct          0x1010
  bcdDevice            0.03
  iManufacturer           1 JESS
  iProduct                2 YUREX
  iSerial                 3 10000269
  bNumConfigurations      1

Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 34
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 0 None
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 31
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 10
Device Status: 0x0002
(Bus Powered)
Remote Wakeup Enabled

 3 files changed, 9 insertions(+), 2 deletions(-)
drivers/hid/hid-core.c +0 -1
index 88cb04e..021d298 100644
@@ -1672,7 +1672,6 @@ static const struct hid_device_id hid_ignore_list[] = {
     { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1006) },
     { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1007) },
     { HID_USB_DEVICE(USB_VENDOR_ID_IMATION, USB_DEVICE_ID_DISC_STAKKA) },
-    { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_JESS_YUREX) },
     { HID_USB_DEVICE(USB_VENDOR_ID_KBGEAR, 

USB_DEVICE_ID_KBGEAR_JAMSTUDIO) },
{ HID_USB_DEVICE(USB_VENDOR_ID_KWORLD,
USB_DEVICE_ID_KWORLD_RADIO_FM700) },

     { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_GPEN_560) },
@@ -1786,6 +1785,11 @@ static bool hid_ignore(struct hid_device *hdev)
             hdev->product <= USB_DEVICE_ID_HANWANG_TABLET_LAST)
             return true;
         break;

+ case USB_VENDOR_ID_JESS:
+ if (hdev->product == USB_DEVICE_ID_JESS_YUREX &&
+ hdev->type == HID_TYPE_USBNONE)
+ return true;

+        break;
     }

     if (hdev->type == HID_TYPE_USBMOUSE &&
drivers/hid/usbhid/hid-core.c +2 -0
index 5489eab..ce3f947 100644
@@ -1168,6 +1168,8 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *
     if (intf->cur_altsetting->desc.bInterfaceProtocol ==
             USB_INTERFACE_PROTOCOL_MOUSE)
         hid->type = HID_TYPE_USBMOUSE;
+    else if (intf->cur_altsetting->desc.bInterfaceProtocol == 0)
+        hid->type = HID_TYPE_USBNONE;
 
     if (dev->manufacturer)
         strlcpy(hid->name, dev->manufacturer, sizeof(hid->name));
include/linux/hid.h +2 -1
index bb0f56f..37f0e59 100644
@@ -453,7 +453,8 @@ struct hid_input {
 
 enum hid_type {
     HID_TYPE_OTHER = 0,
-    HID_TYPE_USBMOUSE
+    HID_TYPE_USBMOUSE,
+    HID_TYPE_USBNONE = -1,
 };
 
 struct hid_driver;
Signature · 1 line
1.7.3.5
#3 lore raw

drivers/hid/hid-core.c static const struct hid_device_id · line 1675

Quoted 7 lines · On Fri, 21 Jan 2011 07:28:49 +0900 Tomoki Sekiyama <[email protected]>…
drivers/hid/hid-core.c +0 -0
@@ -1672,7 +1672,6 @@ static const struct hid_device_id 
 hid_ignore_list[] = {
      { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1006) },
      { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1007) },
      { HID_USB_DEVICE(USB_VENDOR_ID_IMATION, USB_DEVICE_ID_DISC_STAKKA) },

You hit the jackpot. The patch was wordwrapped, space-stuffed and tab-replaced!

Here's my attempt to reconstruct it:

From: Tomoki Sekiyama <[email protected]>

Unfortunately, the device seems to have the same Vendor ID and Product ID as YUREX leg-shakes sensors, and the commit 6bc235a2e2 ("USB: add driver for Meywa-Denki & Kayac YUREX") added the ID to hid_ignore_list.

I believe that we can distinguish YUREX and the Wireless Presenter by device type. The patch below makes the driver ignore only YUREX (bInterfaceProtocol==0), and recognize Wireless Presenter (bInterfaceProtocol is keyboard or mouse) as generic HID. (I don't have the Wireless Presenter, so not yet ested.)

** YUREX lsusb information:
Bus 002 Device 007: ID 0c45:1010 Microdia
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10

   bDeviceClass            0 (Defined at Interface level)
   bDeviceSubClass         0
   bDeviceProtocol         0
   bMaxPacketSize0         8
   idVendor           0x0c45 Microdia
   idProduct          0x1010
   bcdDevice            0.03
   iManufacturer           1 JESS
   iProduct                2 YUREX
   iSerial                 3 10000269
   bNumConfigurations      1

Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 34
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 0 None
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 31
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 10
Device Status: 0x0002
(Bus Powered)
Remote Wakeup Enabled

Addresses https://bugzilla.kernel.org/show_bug.cgi?id=26922

---

 drivers/hid/hid-core.c        |    6 +++++-
 drivers/hid/usbhid/hid-core.c |    2 ++
 include/linux/hid.h           |    3 ++-
 3 files changed, 9 insertions(+), 2 deletions(-)
drivers/hid/hid-core.c renamed from drivers/hid/hid-core.c~usb-yurex-recognize-generalkeys-wireless-presenter-as-generic-hid-re-new-2637-breaks-usb-wireless-presenter-hid-device +5 -1
diff -puN drivers/hid/hid-core.c~usb-yurex-recognize-generalkeys-wireless-presenter-as-generic-hid-re-new-2637-breaks-usb-wireless-presenter-hid-device drivers/hid/hid-core.c
@@ -1710,7 +1710,6 @@ static const struct hid_device_id hid_ig
 	{ HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1006) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1007) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_IMATION, USB_DEVICE_ID_DISC_STAKKA) },
-	{ HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_JESS_YUREX) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_KWORLD, USB_DEVICE_ID_KWORLD_RADIO_FM700) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_GPEN_560) },
@@ -1830,6 +1829,11 @@ static bool hid_ignore(struct hid_device
 		    hdev->product <= USB_DEVICE_ID_HANWANG_TABLET_LAST)
 			return true;
 		break;
+	case USB_VENDOR_ID_JESS:
+		if (hdev->product == USB_DEVICE_ID_JESS_YUREX &&
+				hdev->type == HID_TYPE_USBNONE)
+			return true;
+	break;
 	}
 
 	if (hdev->type == HID_TYPE_USBMOUSE &&
drivers/hid/usbhid/hid-core.c renamed from drivers/hid/usbhid/hid-core.c~usb-yurex-recognize-generalkeys-wireless-presenter-as-generic-hid-re-new-2637-breaks-usb-wireless-presenter-hid-device +2 -0
diff -puN drivers/hid/usbhid/hid-core.c~usb-yurex-recognize-generalkeys-wireless-presenter-as-generic-hid-re-new-2637-breaks-usb-wireless-presenter-hid-device drivers/hid/usbhid/hid-core.c
@@ -1156,6 +1156,8 @@ static int usbhid_probe(struct usb_inter
 	if (intf->cur_altsetting->desc.bInterfaceProtocol ==
 			USB_INTERFACE_PROTOCOL_MOUSE)
 		hid->type = HID_TYPE_USBMOUSE;
+	else if (intf->cur_altsetting->desc.bInterfaceProtocol == 0)
+		hid->type = HID_TYPE_USBNONE;
 
 	if (dev->manufacturer)
 		strlcpy(hid->name, dev->manufacturer, sizeof(hid->name));
include/linux/hid.h renamed from include/linux/hid.h~usb-yurex-recognize-generalkeys-wireless-presenter-as-generic-hid-re-new-2637-breaks-usb-wireless-presenter-hid-device +2 -1
diff -puN include/linux/hid.h~usb-yurex-recognize-generalkeys-wireless-presenter-as-generic-hid-re-new-2637-breaks-usb-wireless-presenter-hid-device include/linux/hid.h
@@ -453,7 +453,8 @@ struct hid_input {
 
 enum hid_type {
 	HID_TYPE_OTHER = 0,
-	HID_TYPE_USBMOUSE
+	HID_TYPE_USBMOUSE,
+	HID_TYPE_USBNONE = -1,
 };
 
 struct hid_driver;

_

#4 lore raw

2011/1/21 Andrew Morton <[email protected]>:

Quoted 5 lines

On Fri, 21 Jan 2011 07:28:49 +0900
You hit the jackpot.  The patch was wordwrapped, space-stuffed and tab-replaced!

Here's my attempt to reconstruct it:

Sorry for broken patch, and thanks for your repair.
The patch was confirmed to successfully fix the regression in recognition of Wireless Presenter by the original bug reporter.

https://bugzilla.kernel.org/show_bug.cgi?id=26922

Quoted 11 lines

From: Tomoki Sekiyama <[email protected]>

Unfortunately, the device seems to have the same Vendor ID and Product ID as YUREX leg-shakes sensors, and the commit 6bc235a2e2 ("USB: add driver for Meywa-Denki & Kayac YUREX") added the ID to hid_ignore_list.

I believe that we can distinguish YUREX and the Wireless Presenter by device type.  The patch below makes the driver ignore only YUREX (bInterfaceProtocol==0), and recognize Wireless Presenter (bInterfaceProtocol is keyboard or mouse) as generic HID.  (I don't have the Wireless Presenter, so not yet ested.)