I'm working on custom Bash scripts for mass duplication of USB flash memory and mass testing (using f3
).
I wonder if it's possible to identify what USB port is a pendrive plugged into.
I have USB hubs with numbered ports. If the have some static addresses that I could identify and know if something is plugged into them or not, and what is that (essentially: which /dev/sd* file corresponds to that USB port) I could make it much easier for the users to know what is going on and allow them to remove bad drives early in the process, without waiting till the whole batch is processed and then try to sort out the bad drives from the good ones (this is how I do it now).
I tried searching around but nothing I found seemed to mesh together with what I want to achieve so I decided to ask directly for help in this context.
Rigth now I identify drives by /dev/sd* node names, and the users have no idea what is that. If I could map these to USB ports in a hub, I could present the information based on the USB ports and users could know that port 5 has a bad drive plugged in and they can remove that without interfering with the rest of the process taking place.
I could then even stop doing this in batches and make all ports work simultaneously in loop, the user could plug the drives in and out all the time, keeping track on what is what by the HUB port numbers, it could greatly seed up the workflow.
So the basic question: how can I identify USB ports and USB flash memory plugged into these ports?