Page 1 of 1

USB device file names not consistent

Posted: 26 Jan 2021, 12:40
by mats-olov_rustad
We have an application where we connect one type of sensor to a external USB-RS485-adapter and another type of sensor connected to the RS485-port of our Connect+ module.

Our problem is that the device file names representing the ports doesn't stay the same at all system boots. Most of the time is the external USB-adapter represented by the device file name ttyUSB2 but sometimes it is represented by ttyUSB0 instead. The RS485 port is usually represented by the device file name ttyRS485 which is a symbolic link to the device file ttyUSB0. When the external USB adapter is represented by ttyUSB0 is the RS485 port represented by ttyRS485 which links to ttyUSB1.

It seems to me that the device file names are assigned in the order the USB devices are configured. Is there a way to avoid this race condition and ensure that the USB devices always are represented with the same device file names?

With regards,

Re: USB device file names not consistent

Posted: 26 Jan 2021, 14:40
by dirk
Hi mats-olov_rustad, USB device enumeration does not provide constant paths, I know. Therefore you can use udev rules.
Have a look at this discussion which is in German but maybe you can translate it.
viewtopic.php?f=8&t=2353&p=8762&hilit=udev#p8667

Re: USB device file names not consistent

Posted: 26 Jan 2021, 22:34
by mats-olov_rustad
Thank you Dirk. I will take a look at it and see if my seconday school German is good enough to understand the thread.

With regards,

Re: USB device file names not consistent

Posted: 27 Jan 2021, 19:52
by mats-olov_rustad
A couple of udev rules made a difference. Now we can rely on static symbolic links to the required serial devices regardless of how the Linux kernel assigns device names.

With regards,

Re: USB device file names not consistent

Posted: 12 Mar 2021, 15:37
by dirk
Hi thank you for your positive reply.