Re: How to get consistent names for USB ports...
Thanks Chris!
On Feb 26, 2016, at 10:46 AM, Christopher Swingley <cswingle@swingleydev.com> wrote:
> On Fri, Feb 26, 2016 at 1:51 AM, Rick Thomas <rbthomas@pobox.com> wrote:
>> Is there some systemd/udev/whatever way to force repeatable naming for the /dev/ttyUSB* devices? I'd be happy if I could get something like /dev/ttyUSB<pci-path> where <pci-path> is found by doing something like
>
> I have some systems that have multiple Arduino devices connected and
> use udev rules to set up unique symlinks in /dev for each Arduino.
> Run the following on a known device path:
>
> $ udevadm info --query=name --name=/dev/ttyUSB0 --attribute-walk
>
> Find unique items in this tree and add them to
> /etc/udev/rules.d/59-persistent-usbserial.rules. For example:
>
> DRIVERS=="usb", ATTRS{manufacturer}=="Prolific Technology Inc.",
> ATTRS{product}=="USB-Serial Controller", ATTRS{idProduct}=="2703",
> SYMLINK+="tty_west_station"
>
> When I plug this device in, it gets the next /dev/ttyUSBxx device
> node, but there will also be a symlink to /dev/tty_west_station that I
> can use in scripts to read the data coming from that Arduino (or you
> can use to connect to that particular machine).
Wow! That works great!
Here's what I ended up with:
> # /etc/udev/rules.d/59-persistent-usbserial.rules
> SUBSYSTEMS=="usb", ATTRS{serial}=="DN00K1IP", SYMLINK+="ttyUSBhalf"
>
> SUBSYSTEMS=="usb", ATTRS{serial}=="DN00FISA", SYMLINK+="ttyUSBcube"
>
> SUBSYSTEMS=="usb", ATTRS{serial}=="FTTK4M73", SYMLINK+="ttyUSBkrishna"
Which works even better than I expected, because the symlink follows the client: When I unplug a client and plug it into a different USB slot, the symlink moves to the new slot... way cool!
Thanks!
Rick
Reply to: