Two devices, same USB ID: one needs HID, the other doesn't. How to solve this?

6 messages, 4 authors, 2012-02-02 · open the first message on its own page

Two devices, same USB ID: one needs HID, the other doesn't. How to solve this?

From: Hans Verkuil <hidden>
Date: 2012-01-13 10:42:45

Hi!

I've made a video4linux driver for the USB Keene FM Transmitter. See:

http://www.amazon.co.uk/Keene-Electronics-USB-FM-Transmitter/dp/B003GCHPDY/ref=sr_1_1?ie=UTF8&qid=1326450476&sr=8-1

The driver code is here:

http://git.linuxtv.org/hverkuil/media_tree.git/shortlog/refs/heads/keene

Unfortunately this device has exactly the same USB ID as the Logitech AudioHub
USB speaker (http://www.logitech.com/en-us/439/3503).

The AudioHub has HID support for volume keys, but the FM transmitter needs
a custom V4L2 driver instead.

I've attached the full lsusb -v output of both devices, but this is the diff of
the two:

$ diff keene.txt audiohub.txt -u
--- keene.txt   2012-01-13 11:10:48.265399953 +0100
+++ audiohub.txt        2012-01-13 11:09:45.185398935 +0100
@@ -1,5 +1,5 @@
 
-Bus 007 Device 009: ID 046d:0a0e Logitech, Inc. 
+Bus 003 Device 004: ID 046d:0a0e Logitech, Inc. 
 Device Descriptor:
   bLength                18
   bDescriptorType         1
@@ -12,7 +12,7 @@
   idProduct          0x0a0e 
   bcdDevice            1.00
   iManufacturer           1 HOLTEK 
-  iProduct                2 B-LINK USB Audio  
+  iProduct                2 AudioHub Speaker
   iSerial                 0 
   bNumConfigurations      1
   Configuration Descriptor:
@@ -22,9 +22,8 @@
     bNumInterfaces          3
     bConfigurationValue     1
     iConfiguration          0 
-    bmAttributes         0xa0
+    bmAttributes         0x80
       (Bus Powered)
-      Remote Wakeup
     MaxPower              500mA
     Interface Descriptor:
       bLength                 9
@@ -152,7 +151,7 @@
           bCountryCode            0 Not supported
           bNumDescriptors         1
           bDescriptorType        34 Report
-          wDescriptorLength      22
+          wDescriptorLength      31
          Report Descriptors: 
            ** UNAVAILABLE **
       Endpoint Descriptor:
As you can see, the differences are very small.

In my git tree I worked around it by adding the USB ID to the ignore list
if the Keene driver is enabled, and ensuring that the Keene driver is
disabled by default.

But is there a better method to do this? At least the iProduct strings are
different, is that something that can be tested in hid-core.c?

Regards,

	Hans

Re: Two devices, same USB ID: one needs HID, the other doesn't. How to solve this?

From: Andy Walls <awalls@md.metrocast.net>
Date: 2012-01-13 11:16:40

Hans Verkuil [off-list ref] wrote:
quoted hunk
Hi!

I've made a video4linux driver for the USB Keene FM Transmitter. See:

http://www.amazon.co.uk/Keene-Electronics-USB-FM-Transmitter/dp/B003GCHPDY/ref=sr_1_1?ie=UTF8&qid=1326450476&sr=8-1

The driver code is here:

http://git.linuxtv.org/hverkuil/media_tree.git/shortlog/refs/heads/keene

Unfortunately this device has exactly the same USB ID as the Logitech
AudioHub
USB speaker (http://www.logitech.com/en-us/439/3503).

The AudioHub has HID support for volume keys, but the FM transmitter
needs
a custom V4L2 driver instead.

I've attached the full lsusb -v output of both devices, but this is the
diff of
the two:

$ diff keene.txt audiohub.txt -u
--- keene.txt   2012-01-13 11:10:48.265399953 +0100
+++ audiohub.txt        2012-01-13 11:09:45.185398935 +0100
@@ -1,5 +1,5 @@

-Bus 007 Device 009: ID 046d:0a0e Logitech, Inc. 
+Bus 003 Device 004: ID 046d:0a0e Logitech, Inc. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
@@ -12,7 +12,7 @@
  idProduct          0x0a0e 
  bcdDevice            1.00
  iManufacturer           1 HOLTEK 
-  iProduct                2 B-LINK USB Audio  
+  iProduct                2 AudioHub Speaker
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
@@ -22,9 +22,8 @@
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          0 
-    bmAttributes         0xa0
+    bmAttributes         0x80
      (Bus Powered)
-      Remote Wakeup
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
@@ -152,7 +151,7 @@
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
-          wDescriptorLength      22
+          wDescriptorLength      31
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
As you can see, the differences are very small.

In my git tree I worked around it by adding the USB ID to the ignore
list
if the Keene driver is enabled, and ensuring that the Keene driver is
disabled by default.

But is there a better method to do this? At least the iProduct strings
are
different, is that something that can be tested in hid-core.c?

Regards,

Hans
Maybe it doesn't matter, but what do the Report Descriptors look like?

http://www.slashdev.ca/2010/05/08/get-usb-report-descriptor-with-linux/

Regards,
Andy

Re: Two devices, same USB ID: one needs HID, the other doesn't. How to solve this?

From: Hans Verkuil <hidden>
Date: 2012-01-13 13:29:17

On Friday, January 13, 2012 12:16:51 Andy Walls wrote:
Hans Verkuil [off-list ref] wrote:
quoted
Hi!

I've made a video4linux driver for the USB Keene FM Transmitter. See:

http://www.amazon.co.uk/Keene-Electronics-USB-FM-Transmitter/dp/B003GCHPDY/ref=sr_1_1?ie=UTF8&qid=1326450476&sr=8-1

The driver code is here:

http://git.linuxtv.org/hverkuil/media_tree.git/shortlog/refs/heads/keene

Unfortunately this device has exactly the same USB ID as the Logitech
AudioHub
USB speaker (http://www.logitech.com/en-us/439/3503).

The AudioHub has HID support for volume keys, but the FM transmitter
needs
a custom V4L2 driver instead.

I've attached the full lsusb -v output of both devices, but this is the
diff of
the two:

$ diff keene.txt audiohub.txt -u
--- keene.txt   2012-01-13 11:10:48.265399953 +0100
+++ audiohub.txt        2012-01-13 11:09:45.185398935 +0100
@@ -1,5 +1,5 @@

-Bus 007 Device 009: ID 046d:0a0e Logitech, Inc. 
+Bus 003 Device 004: ID 046d:0a0e Logitech, Inc. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
@@ -12,7 +12,7 @@
  idProduct          0x0a0e 
  bcdDevice            1.00
  iManufacturer           1 HOLTEK 
-  iProduct                2 B-LINK USB Audio  
+  iProduct                2 AudioHub Speaker
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
@@ -22,9 +22,8 @@
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          0 
-    bmAttributes         0xa0
+    bmAttributes         0x80
      (Bus Powered)
-      Remote Wakeup
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
@@ -152,7 +151,7 @@
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
-          wDescriptorLength      22
+          wDescriptorLength      31
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
As you can see, the differences are very small.

In my git tree I worked around it by adding the USB ID to the ignore
list
if the Keene driver is enabled, and ensuring that the Keene driver is
disabled by default.

But is there a better method to do this? At least the iProduct strings
are
different, is that something that can be tested in hid-core.c?

Regards,

Hans
Maybe it doesn't matter, but what do the Report Descriptors look like?

http://www.slashdev.ca/2010/05/08/get-usb-report-descriptor-with-linux/
Attached the new lsusb outputs, this time with the report descriptor.

Note that if I plug in the Keene transmitter, then no input device is
created:

Jan 13 14:25:12 tschai kernel: [ 1686.020166] usb 7-4: new full-speed USB device number 3 using ohci_hcd
Jan 13 14:25:12 tschai kernel: [ 1686.248735] generic-usb 0003:046D:0A0E.0009: hiddev0,hidraw4: USB HID v1.10 Device [HOLTEK  B-LINK USB Audio  ] on usb-0000:00:16.0-4/input2

Compare that to what happens when the audiohub is plugged in:

Jan 13 14:25:49 tschai kernel: [ 1722.820125] usb 3-4: new high-speed USB device number 6 using ehci_hcd
Jan 13 14:25:49 tschai kernel: [ 1722.973529] hub 3-4:1.0: USB hub found
Jan 13 14:25:49 tschai kernel: [ 1722.973960] hub 3-4:1.0: 4 ports detected
Jan 13 14:25:49 tschai kernel: [ 1723.250629] usb 3-4.4: new full-speed USB device number 7 using ehci_hcd
Jan 13 14:25:49 tschai kernel: [ 1723.390888] input: HOLTEK  AudioHub Speaker as /devices/pci0000:00/0000:00:16.2/usb3/3-4/3-4.4/3-4.4:1.2/input/input12
Jan 13 14:25:49 tschai kernel: [ 1723.391176] generic-usb 0003:046D:0A0E.000A: input,hidraw4: USB HID v1.10 Device [HOLTEK  AudioHub Speaker] on usb-0000:00:16.2-4.4/input2

I'm no expert on usb and HID, so I hope someone can point me to a better solution.

Regards,

	Hans

Re: Two devices, same USB ID: one needs HID, the other doesn't. How to solve this?

From: Anssi Hannula <hidden>
Date: 2012-01-13 13:49:53

On 13.01.2012 12:42, Hans Verkuil wrote:
Hi!
Hi!

Adding Jiri Kosina, the HID maintainer.
I've made a video4linux driver for the USB Keene FM Transmitter. See:

http://www.amazon.co.uk/Keene-Electronics-USB-FM-Transmitter/dp/B003GCHPDY/ref=sr_1_1?ie=UTF8&qid=1326450476&sr=8-1

The driver code is here:

http://git.linuxtv.org/hverkuil/media_tree.git/shortlog/refs/heads/keene

Unfortunately this device has exactly the same USB ID as the Logitech AudioHub
USB speaker (http://www.logitech.com/en-us/439/3503).

The AudioHub has HID support for volume keys, but the FM transmitter needs
a custom V4L2 driver instead.

I've attached the full lsusb -v output of both devices, but this is the diff of
the two:

$ diff keene.txt audiohub.txt -u
[...]
quoted hunk
@@ -152,7 +151,7 @@
           bCountryCode            0 Not supported
           bNumDescriptors         1
           bDescriptorType        34 Report
-          wDescriptorLength      22
+          wDescriptorLength      31
          Report Descriptors: 
            ** UNAVAILABLE **
       Endpoint Descriptor:
As you can see, the differences are very small.
The HID Report descriptors could be interesting as they differ. You can
look at them in:
/sys/kernel/debug/hid/*/rdesc

I guess one option would be to make this a "regular" HID driver like
those in drivers/hid/hid-*.c (and just set the v4l things up if the
descriptor is as expected, otherwise let standard HID-input handle
them), but there is the issue of where to place the driver, then, as it
can't be both in drivers/hid and drivers/media...

Probably the easy way out is to simply add the device into
drivers/hid/hid-core.c:hid_ignore(), by checking e.g.
vendor+product+name, and hope all "B-LINK USB Audio" devices are FM
transmitters (the name suggests that may not necessarily be the case,
though). Report descriptor contents are not available at hid_ignore()
point yet.
In my git tree I worked around it by adding the USB ID to the ignore list
if the Keene driver is enabled, and ensuring that the Keene driver is
disabled by default.

But is there a better method to do this? At least the iProduct strings are
different, is that something that can be tested in hid-core.c?

Regards,

	Hans

-- 
Anssi Hannula

Re: Two devices, same USB ID: one needs HID, the other doesn't. How to solve this?

From: Hans Verkuil <hidden>
Date: 2012-01-13 14:22:54

On Friday, January 13, 2012 14:34:49 Anssi Hannula wrote:
On 13.01.2012 12:42, Hans Verkuil wrote:
quoted
Hi!
Hi!

Adding Jiri Kosina, the HID maintainer.
quoted
I've made a video4linux driver for the USB Keene FM Transmitter. See:

http://www.amazon.co.uk/Keene-Electronics-USB-FM-Transmitter/dp/B003GCHPDY/ref=sr_1_1?ie=UTF8&qid=1326450476&sr=8-1

The driver code is here:

http://git.linuxtv.org/hverkuil/media_tree.git/shortlog/refs/heads/keene

Unfortunately this device has exactly the same USB ID as the Logitech AudioHub
USB speaker (http://www.logitech.com/en-us/439/3503).

The AudioHub has HID support for volume keys, but the FM transmitter needs
a custom V4L2 driver instead.

I've attached the full lsusb -v output of both devices, but this is the diff of
the two:

$ diff keene.txt audiohub.txt -u
[...]
quoted
@@ -152,7 +151,7 @@
           bCountryCode            0 Not supported
           bNumDescriptors         1
           bDescriptorType        34 Report
-          wDescriptorLength      22
+          wDescriptorLength      31
          Report Descriptors: 
            ** UNAVAILABLE **
       Endpoint Descriptor:
As you can see, the differences are very small.
The HID Report descriptors could be interesting as they differ. You can
look at them in:
/sys/kernel/debug/hid/*/rdesc

I guess one option would be to make this a "regular" HID driver like
those in drivers/hid/hid-*.c (and just set the v4l things up if the
descriptor is as expected, otherwise let standard HID-input handle
them), but there is the issue of where to place the driver, then, as it
can't be both in drivers/hid and drivers/media...

Probably the easy way out is to simply add the device into
drivers/hid/hid-core.c:hid_ignore(), by checking e.g.
vendor+product+name, and hope all "B-LINK USB Audio" devices are FM
transmitters (the name suggests that may not necessarily be the case,
though). Report descriptor contents are not available at hid_ignore()
point yet.
I've done this and this works fine.

I googled for "B-LINK USB Audio" and found only references to the Keene
transmitter.

Here is my patch for drivers/hid that solves this issue:


[RFC PATCH] hid-core: ignore the Keene FM transmitter.

The Keene FM transmitter USB device has the same USB ID as
the Logitech AudioHub Speaker, but it should ignore the hid.
Check if the name is that of the Keene device.

Signed-off-by: Hans Verkuil <redacted>
---
 drivers/hid/hid-core.c |   10 ++++++++++
 drivers/hid/hid-ids.h  |    1 +
 2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index af35384..f02d197 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1973,6 +1973,16 @@ static bool hid_ignore(struct hid_device *hdev)
 		if (hdev->product >= USB_DEVICE_ID_LOGITECH_HARMONY_FIRST &&
 				hdev->product <= USB_DEVICE_ID_LOGITECH_HARMONY_LAST)
 			return true;
+		/*
+		 * The Keene FM transmitter USB device has the same USB ID as
+		 * the Logitech AudioHub Speaker, but it should ignore the hid.
+		 * Check if the name is that of the Keene device.
+		 * For reference: the name of the AudioHub is
+		 * "HOLTEK  AudioHub Speaker".
+		 */
+		if (hdev->product == USB_DEVICE_ID_LOGITECH_AUDIOHUB &&
+			!strcmp(hdev->name, "HOLTEK  B-LINK USB Audio  "))
+				return true;
 		break;
 	case USB_VENDOR_ID_SOUNDGRAPH:
 		if (hdev->product >= USB_DEVICE_ID_SOUNDGRAPH_IMON_FIRST &&
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 4a441a6..2f6dc92 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -440,6 +440,7 @@
 #define USB_DEVICE_ID_LG_MULTITOUCH	0x0064
 
 #define USB_VENDOR_ID_LOGITECH		0x046d
+#define USB_DEVICE_ID_LOGITECH_AUDIOHUB 0x0a0e
 #define USB_DEVICE_ID_LOGITECH_RECEIVER	0xc101
 #define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST  0xc110
 #define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f
-- 
1.7.7.3

Comments? Or even better, an Acked-by?

I'd like to get this driver in for v3.4, that would be nice.

Regards,

	Hans

Re: Two devices, same USB ID: one needs HID, the other doesn't. How to solve this?

From: Jiri Kosina <hidden>
Date: 2012-02-02 08:52:30

On Fri, 13 Jan 2012, Hans Verkuil wrote:
quoted hunk
[RFC PATCH] hid-core: ignore the Keene FM transmitter.

The Keene FM transmitter USB device has the same USB ID as
the Logitech AudioHub Speaker, but it should ignore the hid.
Check if the name is that of the Keene device.

Signed-off-by: Hans Verkuil <redacted>
---
 drivers/hid/hid-core.c |   10 ++++++++++
 drivers/hid/hid-ids.h  |    1 +
 2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index af35384..f02d197 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1973,6 +1973,16 @@ static bool hid_ignore(struct hid_device *hdev)
 		if (hdev->product >= USB_DEVICE_ID_LOGITECH_HARMONY_FIRST &&
 				hdev->product <= USB_DEVICE_ID_LOGITECH_HARMONY_LAST)
 			return true;
+		/*
+		 * The Keene FM transmitter USB device has the same USB ID as
+		 * the Logitech AudioHub Speaker, but it should ignore the hid.
+		 * Check if the name is that of the Keene device.
+		 * For reference: the name of the AudioHub is
+		 * "HOLTEK  AudioHub Speaker".
+		 */
+		if (hdev->product == USB_DEVICE_ID_LOGITECH_AUDIOHUB &&
+			!strcmp(hdev->name, "HOLTEK  B-LINK USB Audio  "))
+				return true;
 		break;
 	case USB_VENDOR_ID_SOUNDGRAPH:
 		if (hdev->product >= USB_DEVICE_ID_SOUNDGRAPH_IMON_FIRST &&
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 4a441a6..2f6dc92 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -440,6 +440,7 @@
 #define USB_DEVICE_ID_LG_MULTITOUCH	0x0064
 
 #define USB_VENDOR_ID_LOGITECH		0x046d
+#define USB_DEVICE_ID_LOGITECH_AUDIOHUB 0x0a0e
 #define USB_DEVICE_ID_LOGITECH_RECEIVER	0xc101
 #define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST  0xc110
 #define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f
-- 
1.7.7.3

Comments? Or even better, an Acked-by?

I'd like to get this driver in for v3.4, that would be nice.
This is fine and I will Ack/take it once it goes in with your driver for 
the device.

-- 
Jiri Kosina
SUSE Labs
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help