[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to get consistent names for USB ports...



Rick,

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).

Cheers,

Chris
-- 
Christopher Swingley
Fairbanks, Alaska
http://swingleydev.com/
cswingle@swingleydev.com


Reply to: