Wednesday, February 24, 2016

Detailed USB Device Information from the CLI

I recently needed to get a model number of a Logitech webcam, but it wasn't printed on the device. So I found a neat way to get it from the device itself.

First, run lsusb to list the USB devices on the system. You'll get something like the following:
# lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 003: ID 046d:082d Logitech, Inc.
Bus 006 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 007 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 006 Device 002: ID 2109:0811
 
Then, run it with the bus and device numbers of the device you want information for... for example, in my case of the Logitech webcam (there's a lot more to it, but I truncated to fit here ~ you may want to output it to a file):
# lsusb -D /dev/bus/usb/001/003
Device: ID 046d:082d Logitech, Inc.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 ?
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x046d Logitech, Inc.
  idProduct          0x082d
  bcdDevice            0.11
  iManufacturer           0
  iProduct                2 HD Pro Webcam C920
  iSerial                 1 2D62DFDF
  bNumConfigurations      1