Patchwork usb: change VID/PID for usb-hub and usb-msd to prevent conflict

login
register
mail settings
Submitter Roy Tam
Date Sept. 15, 2011, 3:25 a.m.
Message ID <CAA=zYJauYBODqRDwZ4nXoopmcOUqRNUr-b9MZeEtV-UxvLT_6A@mail.gmail.com>
Download mbox | patch
Permalink /patch/114732/
State New
Headers show

Comments

Roy Tam - Sept. 15, 2011, 3:25 a.m.
Some USB drivers, for example USBASPI.SYS, will skip different type of
device which has same VID/PID. The following patch helps preventing
usb-msd being skipped by the driver.

Sign-off-by: Roy Tam <roytam@gmail.com>
--
Gerd Hoffmann - Sept. 15, 2011, 4:06 p.m.
On 09/15/11 05:25, Roy Tam wrote:
> Some USB drivers, for example USBASPI.SYS, will skip different type of
> device which has same VID/PID. The following patch helps preventing
> usb-msd being skipped by the driver.

How and why did you pick those IDs?

>   static const USBDesc desc_hub = {
>       .id = {
> -        .idVendor          = 0,
> -        .idProduct         = 0,
> +        .idVendor          = 0x0409,
> +        .idProduct         = 0x55aa,

lsusb says: Bus 004 Device 002: ID 0409:55aa NEC Corp. Hub

Looks sensible.  Is that actually a USB 1.1 Hub?

>   static const USBDesc desc = {
>       .id = {
> -        .idVendor          = 0,
> -        .idProduct         = 0,
> +        .idVendor          = 0x46f4,
> +        .idProduct         = 0x0001,

lsusb doesn't find those IDs in the database.

cheers,
   Gerd
Roy Tam - Sept. 16, 2011, 12:14 a.m.
2011/9/16 Gerd Hoffmann <kraxel@redhat.com>:
> On 09/15/11 05:25, Roy Tam wrote:
>>
>> Some USB drivers, for example USBASPI.SYS, will skip different type of
>> device which has same VID/PID. The following patch helps preventing
>> usb-msd being skipped by the driver.
>
> How and why did you pick those IDs?
>
>>  static const USBDesc desc_hub = {
>>      .id = {
>> -        .idVendor          = 0,
>> -        .idProduct         = 0,
>> +        .idVendor          = 0x0409,
>> +        .idProduct         = 0x55aa,
>
> lsusb says: Bus 004 Device 002: ID 0409:55aa NEC Corp. Hub
>
> Looks sensible.  Is that actually a USB 1.1 Hub?
>

Yes. If you want a USB 2.0 ID, use 0x03f0:0x2002 (HP Hub) instead.
Using USB 1.1 ID to prevent "High Speed" information cloud in XP.
BTW I can't add "usb-ehci" in my MinGW build, it just not available in
"-device ?".

>>  static const USBDesc desc = {
>>      .id = {
>> -        .idVendor          = 0,
>> -        .idProduct         = 0,
>> +        .idVendor          = 0x46f4,
>> +        .idProduct         = 0x0001,
>
> lsusb doesn't find those IDs in the database.
>

This is expected. Just like my ATA-to-USB adapter which has
0x152D:0x2338 and not in usb.ids.
0x46f4 is CRC16() of "QEMU".

> cheers,
>  Gerd
>
>
Gerd Hoffmann - Sept. 16, 2011, 9:46 a.m.
Hi,

>> lsusb says: Bus 004 Device 002: ID 0409:55aa NEC Corp. Hub
>>
>> Looks sensible.  Is that actually a USB 1.1 Hub?
>>
>
> Yes. If you want a USB 2.0 ID, use 0x03f0:0x2002 (HP Hub) instead.
> Using USB 1.1 ID to prevent "High Speed" information cloud in XP.

No, a USB 1.1 Hub ID is perfectly fine as we are actually emulating a 
1.1 Hub.  Just asking because it wasn't obvious whenever this is a 1.1 
or 2.0 hub id.

> 0x46f4 is CRC16() of "QEMU".

Ok.  I'll add that as comment to the patch.

thanks,
   Gerd

Patch

diff --git a/hw/usb-hub.c b/hw/usb-hub.c
index 286e3ad..449dd4d 100644
--- a/hw/usb-hub.c
+++ b/hw/usb-hub.c
@@ -127,8 +127,8 @@  static const USBDescDevice desc_device_hub = {

 static const USBDesc desc_hub = {
     .id = {
-        .idVendor          = 0,
-        .idProduct         = 0,
+        .idVendor          = 0x0409,
+        .idProduct         = 0x55aa,
         .bcdDevice         = 0x0101,
         .iManufacturer     = STR_MANUFACTURER,
         .iProduct          = STR_PRODUCT,
diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index e92434c..4826045 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -162,8 +162,8 @@  static const USBDescDevice desc_device_high = {

 static const USBDesc desc = {
     .id = {
-        .idVendor          = 0,
-        .idProduct         = 0,
+        .idVendor          = 0x46f4,
+        .idProduct         = 0x0001,
         .bcdDevice         = 0,
         .iManufacturer     = STR_MANUFACTURER,
         .iProduct          = STR_PRODUCT,