Skip to content

130 Fixed Naming of USB tty devices ‐ udev rule

Phil edited this page Aug 14, 2024 · 3 revisions

see what you have:

ls -la /dev/serial/by-id/

grafik

identify 'ID' of the device by

lsusb

grafik

get detailed info of the device by

lsusb -v -d <'ID'>

grafik

usually the best thing would be to use the serial number for identification, in case of that funny adapter the serial is '0', so in this case we have to use the combination of vendor and product and hope that we don't will have a second device of this...

to apply a user defined name to that device, create an new udef rule:

sudo nano /etc/udev/rules.d/99-usb-serial.rules

copy & paste this (for each tty device you like to apply a name defined by you):

# we don't have unique serial here
#SUBSYSTEM=="tty", ATTRS{iSerial}=="12345678", SYMLINK+="ttyMyPort"
# so we use vendor and product
SUBSYSTEM=="tty", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", SYMLINK+="ttyMyPort"

for serial, sometimes ATTRS{serial} works, sometimes ATTRS{iSerial} works, sometimes ATTR{serial} - you need have a look at how it is given and to give it a try...

save that file! afterwards you need to reload the udev rules

sudo udevadm control --reload-rules && sudo udevadm trigger

now you should see your applied name using

ls /dev/tty* (or whatever name you have choosen)

grafik (in my case I used 'ttyVito' for the Optolink)

Now you can specify the port by using "/dev/ttyMyPort" eg. in the settings_ini