Silicon's blog

Menu
  • Home
  • Kadena
  • Solana
  • Ethereum
  • Bot Automation
  • Proxmox
  • Nginx Proxy Manager
  • Others
  • Contact
Menu

How to bind USB port with a static name on Linux (Rasbian/Debian/Ubuntu)

Posted on January 11, 2023May 17, 2023 by Silicon
Sharing is Caring:
Twitter 0
Copy 0

 

  Assigning them a static name can be incredibly useful if you have multiple USB serial ports on a single device, as you don’t have to remember their ID anymore. This article will show you how to assign a static name to a specific serial port on Linux systems such as Raspbian (Debian) and Ubuntu.

Step 1: Open a terminal. List the serial devices on your system. You may figure out the serial number of your USB device by disconnecting and connecting it to your system.

ls /dev/ttyUSB*

Step 2: Figure out the bus number and port number of your USB device using

dmesg | grep ttyUSB

It will show something likes

output:[ 5.290556] usb 1-1.3.1: ch341-uart converter now attached to ttyUSB0

In my case, the USB device path is 1-1.3.1. Jot the path down, and we will use this path later. If it shows nothing, you may try another method.

sudo apt install udev -y

By running

udevadm info -a -n /dev/ttyUSB0

It will show something like


 looking at device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3/1-1.3.1/1-1.3.1:1.0/ttyUSB0/tty/ttyUSB0':
  KERNEL=="ttyUSB0"
  SUBSYSTEM=="tty"
  DRIVER==""

We will get an identical result. The USB device path of ttyUSB0 is 1-1.3.1.

Step 3: Edit the USB serial rules on your Linux system.

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

Add this line at the end of the 10-usb-serial.rules. Change your-device-name to a static name you want to assign.

SUBSYSTEM=="tty", KERNELS=="1-1.3.1", SYMLINK+="your-device-name"

In my case, it is

SUBSYSTEM=="tty", KERNELS=="1-1.3.1", SYMLINK+="ttyUSB-TEMPERATURE"

Press Ctrl + X to save the file.

Step 4: Reload the udev rules to take effect. You may also reboot your system to update the udev rules.

sudo udevadm trigger

Step 5: Verify the changes.

ls -l /dev/ttyUSB*

The result will look like


crw-rw----+ 1 root dialout 188, 6 Jan 11 18:27 /dev/ttyUSB0
lrwxrwxrwx 1 root root 7 Dec 17 14:17 /dev/ttyUSB-TEMPERATURE-> ttyUSB0

Congratulations, you have already bound a static name to a USB port. Your life will be easier as you don’t have to remember the port name of a USB device anymore.

Leave a Reply Cancel reply


The reCAPTCHA verification period has expired. Please reload the page.

©2025 Silicon's blog
Click to Copy