lsusb 'idProduct' verus 'iProduct' fields

If I execute an lsusb -v command, I get both a field named idProduct and a field named iProduct.

For many devices, iProduct is set to 0, but for others it is set to a product name.

Why are there two product entries, and how do they differ?

What determines whether iProduct is 0 or a string?


Solution 1:

The idProduct value comes from the OS identification of the device, while the iProduct (interface product) is the self-reported identification of the device. If the iProduct (or iSerial / iManufacturer) value is not set by the vendor, then it will be blank and you will only see an index position of 0 next to the empty space where a value is expected to be. You can see this more clearly with the help of grep:

lsusb -v | grep -E '\<(Bus|idProduct|iProduct|iSerial|iManufacturer)'

This will give you something like:

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
  idProduct          0x0003 3.0 root hub
  iManufacturer           3 Linux 5.13.0-20-generic xhci-hcd
  iProduct                2 xHCI Host Controller
  iSerial                 1 0000:00:14.0
Bus 001 Device 005: ID 138a:0097 Validity Sensors, Inc. 
  idProduct          0x0097 
  iManufacturer           0 
  iProduct                0 
  iSerial                 1 66e5848914da
Bus 001 Device 004: ID 04f2:b5ce Chicony Electronics Co., Ltd Integrated Camera
  idProduct          0xb5ce Integrated Camera
  iManufacturer           1 Chicony Electronics Co.,Ltd.
  iProduct                2 Integrated Camera
  iSerial                 0 
Bus 001 Device 003: ID 8087:0a2b Intel Corp. Bluetooth wireless interface
  idProduct          0x0a2b Bluetooth wireless interface
  iManufacturer           0 
  iProduct                0 
  iSerial                 0 
Bus 001 Device 002: ID 04f2:b5cf Chicony Electronics Co., Ltd Integrated IR Camera
  idProduct          0xb5cf Integrated IR Camera
  iManufacturer           1 SunplusIT Inc
  iProduct                2 Integrated IR Camera
  iSerial                 0 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
  idProduct          0x0002 2.0 root hub
  iManufacturer           3 Linux 5.13.0-20-generic xhci-hcd
  iProduct                2 xHCI Host Controller
  iSerial                 1 0000:00:14.0

Note how when the values of iManufacturer, iProduct, and iSerial are set, there is a non-zero number. This comes from the order of the information provided via the device identification header when the USB device is discovered by the OS. There is no enforced order, so the 1, 2, 3 values can be assigned to any of the iManufacturer, iProduct, or iSerial values.