Persistent serial ports on Ubuntu

Last time I rebooted my file server (which has a couple of serial devices attached), it picked the wrong ones for /dev/ttyUSB0 and /dev/ttyUSB1. That meant the speeds (which I’d configured in minicomrc files) were wrong.

I needed to make the serial ports persistent. Again with the udev rules!

Luckily, there was a handy page at:
indilib.org/support/tutorials/157-persistent-serial-port-mapping.html

with what I needed to know. I ended up adding two rules in /lib/udev/rules.d/99-serial-aliases.rules:
# portal
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="AM00NPHK", MODE="0666", SYMLINK+="ttyPortal"
# wally
SUBSYSTEMS=="usb", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{serial}=="0130D901", MODE="0666", SYMLINK+="ttyWally"

I got these values by running lsusb -v (which in truth gives you everything you need to know) and:
udevadm info -a -n /dev/ttyUSB0 | grep serial | head -1
and
udevadm info -a -n /dev/ttyUSB1 | grep serial | head -1
on my two serial ports. (I could also grep idProduct and idVendor, but lsusb gave me the right ones already.)

Then delete (sigh) /lib/udev/rules.d/99-serial-aliases.rules~ that Emacs left over. Cause it gets read if you don’t. Sigh. I always forget.

After that a quick:
sudo udevadm control --reload-rules
sudo udevadm trigger

and I had my /dev/ttyPortal and /dev/ttyWally. Now to fix up those minicom configs…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: