Page 1 of 1

Understanding vid/pid pairs

Posted: Wed Dec 07, 2011 11:44 pm
by Peter Chaffe
Hi Gents,

I think I'm grasping some of the usbconfig.h defines, but have a problem here!
As an example I want to use a keyboard.

so;
USB-IDs-for-free.txt suggests preference to using "discrimination by serial number string"
Which makes me think I need to use

discrimination by serial number string:
---------------+---------------+-------------------------------------------
10203 (0x27db) | 5824 (0x16c0) | For USB Keyboards
---------------+---------------+-------------------------------------------

Yet in the statements within usbconfig.h it gives a keyboard example using "discrimination by textual name"

discrimination by textual name:
--------------+---------------+--------------------------------------------
1503 (0x05df) | 5824 (0x16c0) | For generic HID class devices (which are
| | NOT mice, keyboards or joysticks)
--------------+---------------+--------------------------------------------

But as you can see above it expressly says NOT for keyboards etc.

Can anyone shed some light? The vids are the same in both cases but the pids aren't.
Which should I use?


Second question is I don't understand to process to convert either of the above combinations into these hex number pairs?

#define USB_CFG_VENDOR_ID 0x42, 0x42
#define USB_CFG_DEVICE_ID 0x31, 0xe1 (example taken from 1-key-keyboard project)

Any help appreciated!


Edit.................

Think I can answer my own questions!

Q2) I think is someone elses vid/pid pair or just made up! that happens to work...

q1) I have ignored all else and chosen the recomended pair as per "USB-IDs-for-free.txt

10203 (0x27db) | 5824 (0x16c0) | For USB Keyboards

#define USB_CFG_VENDOR_ID 0xc0, 0x16
#define USB_CFG_DEVICE_ID 0xdb, 0x27

and it works fine!

Re: Understanding vid/pid pairs

Posted: Wed Dec 26, 2012 8:54 pm
by xiangrui
The VID/PID pair won't affect the device, unless they conflict with the existing device. This means, if you set some random numbers for the pair, it normally works fine. For more information about the pair, check the file USB-ID-FAQ.txt in the V-USB package.

I do have a question about the VID/PID pair for the USB keyboard/mice/joystick. V-USB provides shared VID/PID pairs for these device, if they are discriminated by serial number. However, the driver of these device is provided by operating system, and according to USB-IDs-for-free.txt, we can omit the serial number. But why don't the keyboard and mouse examples from V-USB use these pairs, rather use some pairs for demonstration only? Can anyone point out what I missed? Thanks.

-Xiangrui

Re: Understanding vid/pid pairs

Posted: Thu Dec 27, 2012 6:07 pm
by xiangrui
I read from the file usbconfig.h for HIDkeys examply that "We cannot use Obdev's free shared VID/PID pair because this is a HID." Does this imply that the pair 0x27db and 0x16c0 is "For USB Keyboards" which are not HID? It seems to me all USB keyboards I ever used are HID. Anyone can make this clear? Thanks.
-Xiangrui