I have multiple USB devices in my PI, and when I reboot, sometimes their "dev" path changes - e.g. from /dev/ttyUSB0 to /dev/ttyUSB1.
Is there a way to control that so that the same USB device will always have the same dev path? Or is there another path somewhere else that I can consistently access the expected USB device?
Long story short, I use the PI as a serial server, so I ssh to it to connect to attached USB devices. Sometimes they shuffle on reboot which is confusing.
- FTrevorGowen
- Forum Moderator
- Posts: 6157
- Joined: Mon Mar 04, 2013 6:12 pm
- Location: Bristol, U.K.
- Contact: Website
Re: USB Devices sometimes change path on reboot (/dev/ttyUSB
Are the devices always plugged into the same USB ports on the Pi? For example USB sticks can end up with swapped /dev/sd?? entries if not (auto-)mounted by label or UUID if not physically plugged into the same ports and I'm wondering if the same applies to serial devices.jabberwok wrote:I have multiple USB devices in my PI, and when I reboot, sometimes their "dev" path changes - e.g. from /dev/ttyUSB0 to /dev/ttyUSB1.
Is there a way to control that so that the same USB device will always have the same dev path? Or is there another path somewhere else that I can consistently access the expected USB device?
Long story short, I use the PI as a serial server, so I ssh to it to connect to attached USB devices. Sometimes they shuffle on reboot which is confusing.
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's & P400. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm
Re: USB Devices sometimes change path on reboot (/dev/ttyUSB
I'm not particularly familiar with it myself but I think you need to look at udev
You could start here:
https://wiki.debian.org/udev
Hope this helps
You could start here:
https://wiki.debian.org/udev
Hope this helps
- DougieLawson
- Posts: 41079
- Joined: Sun Jun 16, 2013 11:19 pm
- Location: A small cave in deepest darkest Basingstoke, UK
- Contact: Website Twitter
Re: USB Devices sometimes change path on reboot (/dev/ttyUSB
Take a look at
sudo udevadm info -n /dev/ttyUSB0 -a
and see if there's a unique property like a serial number that could be used to write a udev rule.
For example, my Arduino gets
sudo udevadm info -n /dev/ttyUSB0 -a
and see if there's a unique property like a serial number that could be used to write a udev rule.
For example, my Arduino gets
Code: Select all
ATTRS{serial}=="64935343633351C06280"
Any language using left-hand whitespace for syntax is ridiculous
Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.
Any requirement to use a crystal ball or mind reading will result in me ignoring your question.
Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.
Any requirement to use a crystal ball or mind reading will result in me ignoring your question.
-
- Posts: 4277
- Joined: Sun Jan 15, 2012 1:11 pm
Re: USB Devices sometimes change path on reboot (/dev/ttyUSB
And some folks need to stop being fanboys and see the forest behind the trees.
(One of the best lines I've seen on this board lately)
(One of the best lines I've seen on this board lately)