I'm using two identical USB to serial adapter on my Linux system. So depends on who's inserted first, one of them will be represented with name /dev/ttyUSB0 and the other with /dev/ttyUSB1. Is there a trick I can make the name persistent? I have three USB port. Is it possible to link the name to the physical port?



1 Answer 1


If you run udevadm monitor --properties you should see the various properties you can use to create rules from. The ID_PATH property indicates the port the device was plugged into. Insert the serial to usb device to see what udev sees.

So it should be straightforward to create a udev rule that creates a symlink when the device is plugged in, something like:

SUBSYSTEM=="usb_device", SYSFS{idVendor}=="xxxx", SYSFS{idProduct}=="xxxx", ENV{ID_PATH}=="pci....usb-0:1:0",SYMLINK+="ttyUSBport0"
SUBSYSTEM=="usb_device", SYSFS{idVendor}=="xxxx", SYSFS{idProduct}=="xxxx", ENV{ID_PATH}=="pci....usb-0:1:1",SYMLINK+="ttyUSBport1"

This is done from memory so you'll want to confirm the syntax. Change the idvendor and idproduct to the USB VID and PID, and change the ID_PATH to whatever you found in udevadm monitor.

This should leave the normal /dev/ttyUSB0 device there, but also create a symlink to it depending on which port it was plugged into. If you use the symlink in minicom or whatever you are using, you'll always get the right adapter based on the port you plug it into.

  • thanks. Is IDPATH tied to the physical port and doesn't change ever?
    – lang2
    Commented Nov 23, 2011 at 8:22
  • Yeah it is the physical path of the usb controller as it connects to the PCI bus I believe. It could only change if it were a add-on board and you changed the slot it was in I think.
    – Paul
    Commented Nov 23, 2011 at 8:32
  • This is very useful also when using usb-to-ethernet adapters and needing to differentiate between network interfaces. Commented Feb 17, 2017 at 20:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .