2 USB_Naming
jlpoole edited this page 2026-02-19 09:10:26 -08:00

Give your devices permanent and meaningful names so your commands are self-documenting which device you are working with. I decided to have names of /dev/tty + t (for T-Beam) + Device Name in all caps, e.g. /dev/ttytAMY. This is accomplished in Gentoo running Open RC with a rules page, saved at /etc/udev/rules.d/99-ttyt-tbeam.rules 99-ttyt-tbeam.rules , which is uploaded to this project. With my rules:

rnsenv) jlpoole@jp /usr/local/src/microreticulum/microReticulumTbeam/exercises/12_FiveTalk $ ls -l /dev/ttyt*
lrwxrwxrwx 1 root root 7 Feb 19 08:43 /dev/ttytAMY -> ttyACM0
lrwxrwxrwx 1 root root 7 Feb 19 08:43 /dev/ttytBOB -> ttyACM1
lrwxrwxrwx 1 root root 7 Feb 19 08:44 /dev/ttytCY -> ttyACM2
lrwxrwxrwx 1 root root 7 Feb 19 08:44 /dev/ttytDAN -> ttyACM3
lrwxrwxrwx 1 root root 7 Feb 19 08:44 /dev/ttytED -> ttyACM4
(rnsenv) jlpoole@jp /usr/local/src/microreticulum/microReticulumTbeam/exercises/12_FiveTalk $ 

It no longer matters when and in what order I activate/deactivate devices, I can always relay on udev to assign the correct name to the device I intend. That makes loading up the code self-evident with:

pio run -e amy -t upload --upload-port /dev/ttytAMY

At age 69 with devices having acronyms assigned by the kernel in numerical order, i.e. /dev/ttyACM0, it's like herding cats and makes for ambiguous documentation thereafter: how do I know AMY was at /dev/ttyACM0 when I ran the upload script? Answer: I don't. Now I do using its soft-linked name: /dev/ttytAMY