How to get Bus and Device relationship for a /dev/ttyUSB
- by Ernesto Campohermoso
I need to write an script for restart USB dongles. I have all tools but I can't link my /dev/ttyUSBx to physical BUS and DEVICE. An issue is that I have three dongles with the same id vendor and id product.
If I do lsusb the output is:
Bus 001 Device 004: ID 12d1:1003 Huawei Technologies Co., Ltd. E220 HSDPA Modem / E270 HSDPA/HSUPA Modem
Bus 001 Device 006: ID 12d1:1003 Huawei Technologies Co., Ltd. E220 HSDPA Modem / E270 HSDPA/HSUPA Modem
Bus 001 Device 007: ID 12d1:1003 Huawei Technologies Co., Ltd. E220 HSDPA Modem / E270 HSDPA/HSUPA Modem
Bus 001 Device 002: ID 80ee:0021
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
And I have attached it to:
/dev/ttyUSB0
/dev/ttyUSB3
/dev/ttyUSB5
But I want to know which device is related with which Bus Device. By example I need to get the following:
/dev/ttyUSB0 -> Bus 001 Device 006
/dev/ttyUSB3 -> Bus 001 Device 004
/dev/ttyUSB5 -> Bus 001 Device 007
I'm using Ubuntu Server 10.04 and I tested the tools:
lsusb
hal
lsmod
But I can't get the relationship.