Julen Uranga Julen Uranga - 12 days ago 5
Linux Question

Change default usb names in Linux

I am developing an embedded solution using C and I am working with two USB sensors. If I connect each sensor alone they take this names:

Device 1 (I do not know why it takes 6 names...)


  • /dev/ttyACM0

  • /dev/ttyACM1

  • /dev/ttyACM2

  • /dev/ttyACM3

  • /dev/ttyACM4

  • /dev/ttyACM5

  • /dev/ttyACM6



Device 2


  • /dev/ttyACM0



So when I start as an embedded system and both sensors are connected, the fastest one takes /dev/ACM0 but it not always the same. So, when I try to read device 2 I could be reading device 1...

I think that It would be great to change the default names of the sensors. I guess that it is going to be possible but I do not find anything.

Answer

You should try using the names in /dev/serial/by-id instead, since those names include the name of the device and should not depend on the order of connection.

By the way, it is also possible to write udev rules that make symbolic links for the serial ports depending on what device they belong to. I am not sure how that would work for a composite device with 6 serial ports, but there probably is a way to make it work.

Comments