jabberwok
Posts: 4
Joined: Sat Sep 21, 2013 12:01 pm

USB Devices sometimes change path on reboot (/dev/ttyUSBX)

Wed Aug 19, 2015 9:58 pm

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.

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5201
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: USB Devices sometimes change path on reboot (/dev/ttyUSB

Wed Aug 19, 2015 10:13 pm

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.
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.
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, A+ and a B2) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

RobHenry
Posts: 452
Joined: Fri Sep 21, 2012 9:04 pm
Location: UK

Re: USB Devices sometimes change path on reboot (/dev/ttyUSB

Wed Aug 19, 2015 10:27 pm

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

User avatar
DougieLawson
Posts: 36578
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: USB Devices sometimes change path on reboot (/dev/ttyUSB

Wed Aug 19, 2015 10:30 pm

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

Code: Select all

ATTRS{serial}=="64935343633351C06280"
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: USB Devices sometimes change path on reboot (/dev/ttyUSB

Thu Aug 20, 2015 12:06 am

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)

Return to “General discussion”