Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Problem description:

Linux creates a special file when you connect USB devices. Those file are in the form /dev/ttyUSB0 for the first one you plug in, /dev/ttyUSB1 for the second, etc...

Those name are created dynamically and depends on the order devices are plugged in. 

It might me useful to assign static name to those devices to always flash the right mote.

udev allows you to assign alias on certain devices depending on some of their properties. 

 

First let's find the serial number of each USB devices:

$ udevadm info --attribute-walk -n /dev/ttyUSB5 | grep serial

SUBSYSTEMS=="usb-serial"
ATTRS{serial}=="AK004SL3"
ATTRS{serial}=="0000:00:14.0"

Repeat this step for all your devices changing the /dev/ttyUSB to yours.

Once you have the mapping between the aliases you want to apply and the serial number of devices you can put them in a udev rules files like this one :

$ cat /etc/udev/rules.d/10-local.rules
ACTION=="add", ATTRS{serial}=="A9040YRU", SYMLINK+="sniffer"
ACTION=="add", ATTRS{serial}=="AK004SL3", SYMLINK+="dr"
ACTION=="add", ATTRS{serial}=="AK004SL6", SYMLINK+="6n"

Related content:

https://hallard.me/fixed-usb-dev-uteleinfo/

Reference :

http://www.reactivated.net/writing_udev_rules.html