Setting up a fixed address for a USB Device in Linux

The below is an example for an RFXTrx433 USB Transceiver, but the process works the same for any other USB device.

  1. List all USB Devices:


    symlink-lsusb

    (You may have to run the command a few times while the USB device is plugged / unplugged to identify the relevant line)

  2. Once the correct device is identified, take note of its ID parameters. In this case, 0403:6001.
    These correspond to Vendor ID and Product ID respectively.
  3. If no 2 devices share this vendor/product combination, jump to step 6, if more than one device shares this vendor/product combination, you need more info such as the Serial number
  4. Run this in a terminal:

    (if necessary replace ttyUSB0 with ttyUSB1)

  5. 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}:
  6. Edit the following file with your preferred editor:
    /etc/udev/rules.d/99-usb-serial.rules and add this line:

  7. Only provide the ATTRS{idProduct} info if you had to go through steps 4 and 5.
    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
  8. Once done, save and close the file, then restart.
  9. In your application config, instead of providing e.g. /dev/ttsUSB0 you can provide /dev/RFXTrx433

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