gogoer
Posts: 2
Joined: Tue May 30, 2017 5:34 pm

Map usb adapters to /dev ports

Fri May 07, 2021 7:29 am

Hello.
I have RPi 3 B and three uart adapters. Adapters are the same.
When i install them, i can see them in /dev for examle: adapter1 - /dev/ttyUSB0, adapter2 - /dev/ttyUSB1, adapter3 - /dev/ttyUSB2.
But after system reboot the can change their location: adapter1 - /dev/ttyUSB1, adapter2 - /dev/ttyUSB2, adapter3 - /dev/ttyUSB0.

Code: Select all

lsusb
Bus 001 Device 006: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP2102/CP2109 UART Bridge Controller [CP210x family]
Bus 001 Device 005: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP2102/CP2109 UART Bridge Controller [CP210x family]
Bus 001 Device 004: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP2102/CP2109 UART Bridge Controller [CP210x family]
Is there any way to map adapter to ttyUSB port to prevent migration?


Doug_
Posts: 66
Joined: Tue Oct 08, 2019 6:40 pm

Re: Map usb adapters to /dev ports

Mon May 10, 2021 1:45 am

When all the interfaces are plugged in you will find sym links to the port listed in the /dev/serial/by-id/ and /dev/serial/by-path/, these sym links can be used in place of the /dev/ttyUSB0 or similar port reference.

So at the command prompt enter the following to reveal the links:

Code: Select all

ls -l /dev/serial/by-path/

or 

ls -l /dev/serial/by-id/  

Skraps
Posts: 27
Joined: Sat May 08, 2021 7:06 am

Re: Map usb adapters to /dev ports

Mon May 10, 2021 7:24 am

Ive a new zero user right. Then theres a domain format daemon also. So you could map and static the mapping thru avahi. < thats a real thing. Uhh

Im not sure what else to tell ya. Ive never had that problem. Other than procedence as it registers by electrical concurrent or chronological ordering by power thruput.

gogoer
Posts: 2
Joined: Tue May 30, 2017 5:34 pm

Re: Map usb adapters to /dev ports

Tue May 11, 2021 11:27 pm

Thank you for help!
But in my case i have identical devices, and i cannot detect them by idProduct or idVendor.
if i understand there is no way to detect them exatly, it is better to use different adapters.

epoch1970
Posts: 6471
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Map usb adapters to /dev ports

Tue May 11, 2021 11:51 pm

There is the option of detecting the path, i.e. which USB port is connected. That doesn’t change, so you could have something like /dev/usb/top/left/dev0, /dev/usb/bottom/left/dev0 etc.
Use udev rules to create the paths.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

Return to “General discussion”