Could not open symlink to port /dev/ttyACM*
Hi,
tl;dr: I am unable to use my symlink to run rosserial since I would always get a message that there is no such file or directory with the symlink I created.
I've created a symlink to my arduino device using the following udev rules:
KERNEL=="ttyACM[0-9]", MODE="0666"
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{serial}=="8563332343035180E191", ATTRS{idProduct}=="0043", ATTRS{idVendor}=="2341", ATTRS{manufacturer}=="Arduino (www.arduino.cc)", SYMLINK+="/tty-arduino-uno"
and I can see that the symbolic link has been created since I would get this output:
$ ls -la /dev/tty-arduino-uno
lrwxrwxrwx 1 root root 10 Jun 29 14:52 /dev/tty-arduino-uno -> ../ttyACM1
Now I wanted to run rosserial_python
with this symlink but I would always get this error message when I run rosrun rosserial_python serial_node.py _port:=/dev/tty-arduino-uno
:
[ERROR] [1530309034.478989]: Error opening serial: [Errno 2] could not open port /dev/tty-arduino-uno: [Errno 2] No such file or directory: '/dev/tty-arduino-uno'
However, rosserial_python
still works when I do
rosrun rosserial_python serial_node.py _port:=/dev/ttyACM1
I get the following when I run udevadm info -a -n /dev/ttyACM1
:
looking at device '/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1.1/1-1.1:1.0/tty/ttyACM1':
KERNEL=="ttyACM1"
SUBSYSTEM=="tty"
DRIVER==""
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1.1/1-1.1:1.0':
KERNELS=="1-1.1:1.0"
SUBSYSTEMS=="usb"
DRIVERS=="cdc_acm"
ATTRS{authorized}=="1"
ATTRS{bAlternateSetting}==" 0"
ATTRS{bInterfaceClass}=="02"
ATTRS{bInterfaceNumber}=="00"
ATTRS{bInterfaceProtocol}=="01"
ATTRS{bInterfaceSubClass}=="02"
ATTRS{bNumEndpoints}=="01"
ATTRS{bmCapabilities}=="6"
ATTRS{supports_autosuspend}=="1"
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1.1':
KERNELS=="1-1.1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{authorized}=="1"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{bConfigurationValue}=="1"
ATTRS{bDeviceClass}=="02"
ATTRS{bDeviceProtocol}=="00"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bMaxPacketSize0}=="8"
ATTRS{bMaxPower}=="100mA"
ATTRS{bNumConfigurations}=="1"
ATTRS{bNumInterfaces}==" 2"
ATTRS{bcdDevice}=="0001"
ATTRS{bmAttributes}=="c0"
ATTRS{busnum}=="1"
ATTRS{configuration}==""
ATTRS{devnum}=="31"
ATTRS{devpath}=="1.1"
ATTRS{idProduct}=="0043"
ATTRS{idVendor}=="2341"
ATTRS{ltm_capable}=="no"
ATTRS{manufacturer}=="Arduino (www.arduino.cc)"
ATTRS{maxchild}=="0"
ATTRS{quirks}=="0x0"
ATTRS{removable}=="unknown"
ATTRS{serial}=="8563332343035180E191"
ATTRS{speed}=="12"
ATTRS{urbnum}=="15"
ATTRS{version}==" 1.10"
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-1':
KERNELS=="1-1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{authorized}=="1"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{bConfigurationValue}=="1"
ATTRS{bDeviceClass}=="09"
ATTRS{bDeviceProtocol}=="01"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{bMaxPower}=="100mA"
ATTRS{bNumConfigurations}=="1"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bcdDevice}=="0111"
ATTRS{bmAttributes}=="e0"
ATTRS{busnum}=="1"
ATTRS{configuration}==""
ATTRS{devnum}=="2"
ATTRS{devpath}=="1"
ATTRS{idProduct}=="0101"
ATTRS{idVendor}=="1a40"
ATTRS{ltm_capable}=="no"
ATTRS{maxchild}=="4"
ATTRS{product}=="USB 2.0 Hub"
ATTRS{quirks}=="0x0"
ATTRS{removable}=="removable"
ATTRS{speed}=="480"
ATTRS{urbnum}=="733"
ATTRS{version}==" 2.00"
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1':
KERNELS=="usb1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{authorized}=="1"
ATTRS{authorized_default}=="1"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{bConfigurationValue}=="1 ...
I notice the symlink points to a relative path. Not sure that matters, but what happens if you create the symlink manually (disable the
udev
rule for the test) and use the absolute path to/dev/ttyACM1
?Sorry for the delay. That works, but the whole point of me creating the symlink is I don't know what port my devices will be assigned to when I boot up. I have at least 2 devices connected through usb and the ports would change so I had the udev to match the device so I can assign a static name
Anyways, I found an alternative solution, which is to use the id from
/dev/serial/by-id
.I didn't have to add udev rules doing it this way. But thanks!The point of the test was to see whether the symlink was actually created correctly, and whether relative symlinks would work. I know what
udev
is for and why you want to use it.I would suggest to investigate why relative symlinks are being created and whether they are known to cause issues.