Created
February 16, 2017 15:27
-
-
Save ricardodeazambuja/21ec53bbd5c5a3d6927943c5b6c25838 to your computer and use it in GitHub Desktop.
How to force Ubuntu to give the same name to the usb devices (ttyUSB)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://unix.stackexchange.com/a/183492 | |
http://rolfblijleven.blogspot.co.uk/2015/02/howto-persistent-device-names-on.html | |
$ dmesg | grep ttyUSB | |
[ 1173.771734] usb 2-1: FTDI USB Serial Device converter now attached to ttyUSB0 | |
$ udevadm info --name=/dev/ttyUSBx --attribute-walk | |
Udevadm info starts with the device specified by the devpath and then | |
walks up the chain of parent devices. It prints for every device | |
found, all possible attributes in the udev rules key format. | |
A rule to match, can be composed by the attributes of the device | |
and the attributes from one single parent device. | |
looking at device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0/ttyUSB0/tty/ttyUSB0': | |
KERNEL=="ttyUSB0" | |
SUBSYSTEM=="tty" | |
DRIVER=="" | |
looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0/ttyUSB0': | |
KERNELS=="ttyUSB0" | |
SUBSYSTEMS=="usb-serial" | |
DRIVERS=="ftdi_sio" | |
ATTRS{port_number}=="0" | |
ATTRS{latency_timer}=="1" | |
looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0': | |
KERNELS=="2-1:1.0" | |
SUBSYSTEMS=="usb" | |
DRIVERS=="ftdi_sio" | |
ATTRS{bInterfaceClass}=="ff" | |
ATTRS{bInterfaceSubClass}=="ff" | |
ATTRS{bInterfaceProtocol}=="ff" | |
ATTRS{bNumEndpoints}=="02" | |
ATTRS{authorized}=="1" | |
ATTRS{supports_autosuspend}=="1" | |
ATTRS{bAlternateSetting}==" 0" | |
ATTRS{bInterfaceNumber}=="00" | |
ATTRS{interface}=="FT232R USB UART" | |
looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1': | |
KERNELS=="2-1" | |
SUBSYSTEMS=="usb" | |
DRIVERS=="usb" | |
ATTRS{bDeviceSubClass}=="00" | |
ATTRS{bDeviceProtocol}=="00" | |
ATTRS{devpath}=="1" | |
ATTRS{idVendor}=="0403" | |
ATTRS{speed}=="12" | |
ATTRS{bNumInterfaces}==" 1" | |
ATTRS{bConfigurationValue}=="1" | |
ATTRS{bMaxPacketSize0}=="8" | |
ATTRS{busnum}=="2" | |
ATTRS{devnum}=="2" | |
ATTRS{configuration}=="" | |
ATTRS{bMaxPower}=="90mA" | |
ATTRS{authorized}=="1" | |
ATTRS{bmAttributes}=="80" | |
ATTRS{bNumConfigurations}=="1" | |
ATTRS{maxchild}=="0" | |
ATTRS{bcdDevice}=="0600" | |
ATTRS{avoid_reset_quirk}=="0" | |
ATTRS{quirks}=="0x0" | |
ATTRS{serial}=="AI0284F3" | |
ATTRS{version}==" 2.00" | |
ATTRS{urbnum}=="16" | |
ATTRS{ltm_capable}=="no" | |
ATTRS{manufacturer}=="FTDI" | |
ATTRS{removable}=="unknown" | |
ATTRS{idProduct}=="6001" | |
ATTRS{bDeviceClass}=="00" | |
ATTRS{product}=="FT232R USB UART" | |
looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb2': | |
KERNELS=="usb2" | |
SUBSYSTEMS=="usb" | |
DRIVERS=="usb" | |
ATTRS{bDeviceSubClass}=="00" | |
ATTRS{bDeviceProtocol}=="00" | |
ATTRS{devpath}=="0" | |
ATTRS{idVendor}=="1d6b" | |
ATTRS{speed}=="12" | |
ATTRS{bNumInterfaces}==" 1" | |
ATTRS{bConfigurationValue}=="1" | |
ATTRS{bMaxPacketSize0}=="64" | |
ATTRS{authorized_default}=="1" | |
ATTRS{busnum}=="2" | |
ATTRS{devnum}=="1" | |
ATTRS{configuration}=="" | |
ATTRS{bMaxPower}=="0mA" | |
ATTRS{authorized}=="1" | |
ATTRS{bmAttributes}=="e0" | |
ATTRS{bNumConfigurations}=="1" | |
ATTRS{maxchild}=="2" | |
ATTRS{interface_authorized_default}=="1" | |
ATTRS{bcdDevice}=="0404" | |
ATTRS{avoid_reset_quirk}=="0" | |
ATTRS{quirks}=="0x0" | |
ATTRS{serial}=="0000:00:1d.0" | |
ATTRS{version}==" 1.10" | |
ATTRS{urbnum}=="29" | |
ATTRS{ltm_capable}=="no" | |
ATTRS{manufacturer}=="Linux 4.4.0-62-generic uhci_hcd" | |
ATTRS{removable}=="unknown" | |
ATTRS{idProduct}=="0001" | |
ATTRS{bDeviceClass}=="09" | |
ATTRS{product}=="UHCI Host Controller" | |
looking at parent device '/devices/pci0000:00/0000:00:1d.0': | |
KERNELS=="0000:00:1d.0" | |
SUBSYSTEMS=="pci" | |
DRIVERS=="uhci_hcd" | |
ATTRS{irq}=="18" | |
ATTRS{subsystem_vendor}=="0x1ab8" | |
ATTRS{broken_parity_status}=="0" | |
ATTRS{class}=="0x0c0300" | |
ATTRS{driver_override}=="(null)" | |
ATTRS{consistent_dma_mask_bits}=="32" | |
ATTRS{dma_mask_bits}=="32" | |
ATTRS{local_cpus}=="00000003" | |
ATTRS{device}=="0x2658" | |
ATTRS{enable}=="1" | |
ATTRS{msi_bus}=="1" | |
ATTRS{local_cpulist}=="0-1" | |
ATTRS{vendor}=="0x8086" | |
ATTRS{subsystem_device}=="0x0400" | |
ATTRS{numa_node}=="-1" | |
ATTRS{d3cold_allowed}=="0" | |
looking at parent device '/devices/pci0000:00': | |
KERNELS=="pci0000:00" | |
SUBSYSTEMS=="" | |
DRIVERS=="" | |
$ sudo nano /etc/udev/rules.d/99-usb-serial.rules | |
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="AI0284F3", SYMLINK+="USB2Dynamixel01" | |
$ sudo udevadm control --reload-rules | |
$ sudo udevadm trigger | |
or | |
$ /etc/init.d/udev stop | |
$ udevadm control --reload-rules | |
$ /etc/init.d/udev start | |
Another possible solution is to find a unique name with the command below: | |
$ ls -la /dev/serial/by-id | |
Then, after all that, add the current user to the dialout group: | |
(http://askubuntu.com/questions/133235/how-do-i-allow-non-root-access-to-ttyusb0-on-12-04) | |
$ sudo usermod -a -G dialout $USER |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When using the /dev/serial/by-id you MUST pass the whole thing inside your launch file:
port_name: '/dev/serial/by-id/your-fancy-unique-name'