SOLVED autocreate stable /dev/ttyUSBxxx symlinks with udev

For discussion of Phil Tobin's Tuner Studio software (Only about the tuning software itself, not about how to tune or firmware features)

Moderator: LT401Vette

Post Reply
piledriver
Super MS/Extra'er
Posts: 1679
Joined: Tue Oct 27, 2009 6:24 am
Location: Van Alstyne, Texas

SOLVED autocreate stable /dev/ttyUSBxxx symlinks with udev

Post by piledriver »

EDIT:

This is for Linux (any current distribution uses udev for setting up devices)
If you only run Windows, you are missing out, and there is nothing to see here.
...
My one remaining functional neuron just fired.
Don't get too bloody creative with the usb device symlinks you create below.
I renamed them /dev/ttyUSB23, 24, 25, and ttyUSB33 for the MS3.
Tunerstudio can't grok nonstd USB device names, but it picks those up fine, and those are high enough the system won't try to use them unless you have a weird setup..
Works perfectly now.

I left the original post intact below for posterity, just don't use "descriptive" device names/style I originally used below, ts will ignore them.
***********************************

Spent a few minutes Googling, found a "man on base" for udev rules creation, lots of obsolete info out there on udev.

Here's my new /etc/udev/rules.d/10-usb-serial.rules, works as expected, I plug in the ms3 i get the same device every time
In my case, /dev/ttyUSB_MS3_SQBK , based on the serial# of the FTDI chip in my MS3 in the squareback
Did same for the 10hz GPS dongle and dual USB serial adapter.
Had to try somewhat different setups for each device same info didn't work reliably in every case.

The device symlinks are created on plugging in the device, regardless of the somewhat random automagic udev device assignment.

Started with this and used the info at the top to pull required data from udevadm:
https://gist.github.com/cbrake/4337154

Code: Select all


# /etc/udev/rules.d/10-usb-serial.rules
# udevadm info --attribute-walk -n /dev/ttyUSB0  |grep serial (can be used to get serial number)
# udevadm control --reload-rules (reload rules)
# udevadm trigger (re-add all devices)
# see https://wiki.archlinux.org/index.php/Bus_pirate
# for some reason, ATTRS{bInterfaceNumber}=="00" is not working, hence the use of ENV{}

# single USB/serial adapters
SUBSYSTEM=="tty", DRIVERS=="cp210x", SYMLINK+="ttyUSB_venusgps"
SUBSYSTEM=="tty", DRIVERS=="mos7840", ATTRS{port_number}=="0", SYMLINK+="ttyUSB_mc-dual_0"
SUBSYSTEM=="tty", DRIVERS=="mos7840", ATTRS{port_number}=="1", SYMLINK+="ttyUSB_mc-dual_1"
SUBSYSTEM=="tty", ATTRS{serial}=="A400fCvC", SYMLINK+="ttyUSB_MS3_SQBK" 
Last edited by piledriver on Sun Jan 10, 2016 3:34 am, edited 9 times in total.
Always doing things the hard way, MS2 sequential w/ v1.01 mainboard, LS2 coils. 80 mile/day commuter status.
piledriver
Super MS/Extra'er
Posts: 1679
Joined: Tue Oct 27, 2009 6:24 am
Location: Van Alstyne, Texas

Re: SOLVED autocreate stable /dev/ttyUSBxxx symlinks with ud

Post by piledriver »

bump for working solution, edit at top.
Always doing things the hard way, MS2 sequential w/ v1.01 mainboard, LS2 coils. 80 mile/day commuter status.
piledriver
Super MS/Extra'er
Posts: 1679
Joined: Tue Oct 27, 2009 6:24 am
Location: Van Alstyne, Texas

Re: SOLVED autocreate stable /dev/ttyUSBxxx symlinks with ud

Post by piledriver »

working file to copy/paste, creates "fixed" symlinks for MY usb serial adapters/gps etc, your IDs may differ, edit as required:
The last line is for the built in FDTI adapter in an MS3.

Code: Select all


# /etc/udev/rules.d/10-usb-serial.rules
# udevadm info --attribute-walk -n /dev/ttyUSB0  |grep serial (can be used to get serial number)
# udevadm control --reload-rules (reload rules)
# udevadm trigger (re-add all devices)
# see https://wiki.archlinux.org/index.php/Bus_pirate
# for some reason, ATTRS{bInterfaceNumber}=="00" is not working, hence the use of ENV{}

# single USB/serial adapters
SUBSYSTEM=="tty", DRIVERS=="cp210x", SYMLINK+="ttyUSB_20"
SUBSYSTEM=="tty", DRIVERS=="mos7840", ATTRS{port_number}=="0", SYMLINK+="ttyUSB_21"
SUBSYSTEM=="tty", DRIVERS=="mos7840", ATTRS{port_number}=="1", SYMLINK+="ttyUSB_22"
SUBSYSTEM=="tty", ATTRS{serial}=="A400fCvC", SYMLINK+="ttyUSB_33"



Always doing things the hard way, MS2 sequential w/ v1.01 mainboard, LS2 coils. 80 mile/day commuter status.
Post Reply