5

I have a USB-Stick from which I would like to read the serial number. If I invoke the command lsusb -v the output in the line iSerial is as follows:

iSerial    3

If i go to /proc/scsi/usb-storage and look into the file i get the following output:

Host scsi10: usb-storage
Vendor: USB
Product: Disk 2.0
Serial Number: 92071573E1272519149
Protocol: Transparent SCSI
Transport: Bulk
Quirks:

Why is there no serial output with the lsusb command on the one hand, but on the other hand I get a serial number from /proc/scsi/usb-storage. Where is the difference between the two methods to gather the serial?

3 Answers 3

3

lsusb may try to open the USB device as O_RDWR (read/write mode) and your user might not have the rights to do this (some error message "Couldn't open device, some information will be missing" should be inbetween the output, if so). Started as root lsusb should also be able to output the whole iSerial value.

2

There are lots of different USB devices in general (keyboard, mice, webcams, ...). lsusb deals with the connected devices on the USB protocol level.

Some USB device are storage devices (USB sticks, USB harddisks, ...). They understand a different protocol (more or less SCSI) on top of the USB protocol. Within this protocol, an USB storage device has a serial number (as does an ATA device). This is what you see in /proc/scsi/usb-storage.

The iSerial number you see in lsusb has nothing to do with it.

So that's why you see the serial number you are interested in with one method, but not with the other method. And that's why you can't use lsusb to get the kind of serial number you are interested in

1

You can use lsusb with verbose flag, but you need to make sure you use sudo with it, otherwise the serial will be incorrect.

sudo lsusb -v

If that is too verbose, then run lsusb to get the device id:

$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 012: ID 1ab1:0e11 Rigol Technologies
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Then run lsusb with -s flag to show only specified device and grep for the serial number.

So for the serial number of Rigol device:

$ sudo lsusb -s 012 -v|grep -i iserial
  iSerial                 3 DP8C221100000

For more information on lsusb use the --help flag:

$ lsusb --help
Usage: lsusb [options]...
List USB devices
  -v, --verbose
      Increase verbosity (show descriptors)
  -s [[bus]:][devnum]
      Show only devices with specified device and/or
      bus numbers (in decimal)
  -d vendor:[product]
      Show only devices with the specified vendor and
      product ID numbers (in hexadecimal)
  -D device
      Selects which device lsusb will examine
  -t, --tree
      Dump the physical USB device hierarchy as a tree
  -V, --version
      Show version of program
  -h, --help
      Show usage and help

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .