pythonbashusbdevicelsusb

How to know what block device correnponds to the lsusb output?


I need the information provides lsusb about Manufacturer company in usb pendrives, but I don't know how to link it with the block device.

I'm using dbus and python for getting all information about pendrives connected in the system, but DriveVendor and DriveModel don't correspond with Manufacturer company showed with lsusb.

udevadm info gives a lot of information but it haven't the Manufacturer company either.

Perhaps the question is poorly worded and would be better like this: how to get the manufacturer of a pendrive knowing its /dev/ name...or something like that.


Solution

  • Go to /sys/block/<name>, that will be a symbolic link to something like:

    /sys/block/sdf -> ../devices/pci0000:00/0000:00:1a.0/usb3/3-1/3-1.4/3-1.4:1.0/host9/target9:0:0/9:0:0:0/block/sdf
    

    Then go to the that directory, and in the sucessive parents, you will find a lot of files with interesting information.

    The data you are asking for, in my particular example, would be at the directory:

    /sys/devices/pci0000:00/0000:00:1a.0/usb3/3-1/3-1.4
    

    There you can find files manufacturer, product, idVendor and idProduct.