[Dprglist] RPI udev rules by path
Pat Caron
patcaron at mail.com
Wed Jul 20 16:26:44 PDT 2022
I reported during the last DPRG RBNO meeting that I was having
problems programming in PlatformIO using the symlink "/dev/ttyUSB-motors"
I found a problem created by an update to Raspbian Buster that would
assign the symlink to gpiochip2 instead of ttyUSB*.
ls -l /dev/ttyU*
crw-rw-rw- 1 root dialout 188, 0 Jul 20 18:52 /dev/ttyUSB0
lrwxrwxrwx 1 root root 7 Jul 20 18:49 /dev/ttyUSB-motors ->
gpiochip2
I found on https://forums.raspberrypi.com/viewtopic.php?t=283585 that
changing my udev rule in /etc/udev/rules.d/ from SUBSYSTEMS== to
SUBSYSTEM== as in:
ACTION=="add", SUBSYSTEM=="tty", KERNELS=="1-1.1:1.0",
SYMLINK+="ttyUSB-motors"
This rule creates a symlink from a specific USB port to
/dev/ttyUSB-motors (or whatever /dev/???? name you want). I do this so
that USB devices
are always connected to a known device name. When you have multiple USB
devices, they don't always get associated with the same device name
(/dev/ttyUSB0 or ttyUSB1...etc).
After this change, the symlink works properly and I am able to
use upload_port = /dev/ttyUSB-motors in PlatformIO regardless of the system
device name (/dev/ttyUSB*). (so far!)
ls -l /dev/ttyU*
crw-rw-rw- 1 root dialout 188, 0 Jul 20 18:52 /dev/ttyUSB0
lrwxrwxrwx 1 root root 7 Jul 20 18:49 /dev/ttyUSB-motors -> ttyUSB0
I also use the /dev/???? symlink in my python code.
...Pat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dprg.org/pipermail/dprglist-dprg.org/attachments/20220720/8faef5cf/attachment.html>
More information about the DPRGlist
mailing list