On Saturday, 10 December 2016 12:00:37 GMT Terry Coles wrote: > On Saturday, 10 December 2016 11:45:03 GMT William R Sowerbutts wrote: > > You can write a udev rule to name the device according to the USB port it > > is plugged into (either on the host or a downstream hub). This should > > allows you to give them persistent names. > > > > Here's an example for serial ports, I assume the same can be done for > > audio > > devices: > > > > http://askubuntu.com/questions/49910/how-to-distinguish-between-identical-> > > > us b-to-serial-adapters > > Thanks. From this and the link provided by Ralph, it looks like I should be > able to do what I want, based on the physical USB socket that the device is > plugged in to. > > This is ideal, because if the device ever fails, we don't want to have to > reprogram the code, just because someone substitutes the spare. We just > have to ensure that the User Manual makes it clear that it is important > that the correct socket is used.
I spent quite a bit of time trying to get this to work, because although I could easily see the physical interfaces in /sys/bus/usb/devices/, I found it quite difficult to identify the corresponding interfaces in /dev so that I could write the udev rules. Initially I was working with this machine (my Dell Optiplex), plugging three Adaptors into the USB ports on the front. I persevered because I noticed pretty soon that the Card Numbers given by aplay -l were never the same twice, so it looked like I needed to use this technique. I was beginning to think I was going to have to think again about how I guaranteed that the sound came out of the correct speaker. Then I tried it on my Pi Zero, using one of these 'Naked' USB Hubs: https://www.modmypi.com/raspberry-pi/accessories/usb-hubs/hackable-naked-7-port-usb-hub-uk-5v-2.5a/?search=USB%20Hub[1] Surprise, surprise; the three devices always came up in the same order! Anyone know why that happens with the Pi setup and not on my PC? -- Terry Coles -------- [1] https://www.modmypi.com/raspberry-pi/accessories/usb-hubs/hackable-naked-7-port-usb-hub-uk-5v-2.5a/?search=USB%20Hub -- Next meeting: Bournemouth, Tuesday, 2017-01-03 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR