Setting up a fixed address for a USB Device in Ubuntu

Ubuntu lists USB devices by default under /dev/ as ttyUSBx where x is a number starting 0. Issue with this is if USB devices are swapped to a different port, it’s not clear with ttyUSBx device relates to which physical USB device.
There are a few ways to change settings to point to the correct USB Device. I’ll list to 2 most common ways. The below is an examples for an RFXTrx433 USB Transceiver, but the process works the same for any other USB device.

Option A

  1. Point the app to the device’s serial id. Run this in a terminal:
    ls /dev/serial/by-id/
  2. This will list all serial USB devices. Pick the one that you need to communicate with and set its address in your app, e.g.

Option B

    1. Run this in a terminal:
      udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)

      (if necessary replace ttyUSB0 with ttyUSB1)

    2. You need to locate the block where it gives you the correct value for your device, ATTRS{manufacturer} and/or ATTRS{product} and take note of the ATTRS{idVendor} ATTRS{idProduct} and ATTRS{serial}:
    3. Edit the following file with your preferred editor:
      /etc/udev/rules.d/99-usb-serial.rules and add this line:

      ACTION=="add", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="A1XETWB5", SYMLINK+="RFXTrx433"
    4. Replace the values in ATTRS{idVendor} ATTRS{idProduct} and ATTRS{serial} with the ones you found in previous step, replace RFXTrx433 with a name that makes sense to you. Save and Exit
    5. Run this in a terminal:
      sudo udevadm control --reload && sudo udevadm trigger
    6. You should then have a new device listed in /dev matching the name you provided after SYMLINK. To confirm, run this in terminal:
      ls /dev/RFX*

      (replace RFX with the name you provided after SYMLINK)

    7. Enter the device’s “new” address in your app, e.g.

Now it does not matter which USB port your device is connected to, it will always be found.