/dev/bus/usb/*/* lists all the usb devices connected on Alpine Linux. For example a phone could be /dev/bus/usb/001/009. When that phone is reconnected it will be /dev/bus/usb/001/010, i.e. it increments.
My question is what happens after 1001 connections?
/dev/bus/usb/001/009
010
...
100
...
500
...
999
???
Would the ??? go to 1000? Would it create a new folder say 003 under /dev/bus/usb/?
This is for manipulating the output of usb-devices and lsusb. Getting the Vendor and ProdID is not unique in my case.
I'd rather not plug in/out a usb cable 1000 times!
Best Answer
If I read correctly https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/tree/drivers/usb/core/hub.c#n2030 (code for a function called
choose_devnum
), it may wrap far earlier than that, at value 127 in fact, and then going back to 1:And later on the
bus->devnum
property is really set only ifdevnum
is less than 128.