As you know every time USB device is rebooted is devnum
is changed, but physical USB port is the same as was.
Sometimes it's needed to convert static USB path from lsub -t
to current device num on sysfs (/dev/bus/usb/XXX/YYY
). It's useful for working with devices often are rebooted.
Some little solution that I've found, this script just convert static USB path from lsusb -t
utility to current device on sysfs.
For example, you connected your device to your PC. And its physical topology, for example, is: 218
, where 2 is USB bus, and 18 is nested port hierarchy, it's hierarchy will change only if you change physical USB port on your PC.