This page permanently redirects to gemini://m0yng.uk/2024/07/Consistent-device-names-with-udev/.
Created 2024-07-12
=> Tagged
I've often got multiple things plugged into my computer, for example a USB to serial cable for the TNC and a different USB to serial cable for CAT control of my HF radio. These usually show up as something like /dev/ttyUSB0
and /dev/ttyUSB1
.
The problem is that the order is not always the same. Sometimes a reboot results in the devices swapping number and suddenly your software can't talk to the radio anymore.
Let's fix that!
(I'm doing this on Debian 12)
We need to know which device is connected to what, the easiest way to do this is use lsusb
then plug or unplug the device and see what appears/disappears.
For example
lsusb Bus 001 Device 006: ID 08bb:29c6 Texas Instruments PCM2906C Audio CODEC Bus 001 Device 004: ID 067b:23a3 Prolific Technology, Inc. ATEN Serial Bridge Bus 001 Device 003: ID 10c4:ea60 Silicon Labs CP210x UART Bridge
Then I unplug the CAT cable
lsusb Bus 001 Device 006: ID 08bb:29c6 Texas Instruments PCM2906C Audio CODEC Bus 001 Device 004: ID 067b:23a3 Prolific Technology, Inc. ATEN Serial Bridge
Now I know that 067b:23a3
is the TNC and 10c4:ea60
is the CAT.
Create or edit /etc/udev/rules.d/99-usbtty.rules
and populate it with something like this:
SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SYMLINK+="ttyUSBIcomCat" SUBSYSTEM=="tty", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="23a3", SYMLINK+="TNC"
We're tell it to look for a device with the vendor id 10c4
and product id ea60
and then create a symbolic link called ttyUSBIcomCat
to point to the actual device.
This way we can tell our software to always look for /dev/ttyUSBIcomCat
and it doesn't matter if it's number 0, 1, or 6352528.
You'll need to reboot or kick udev somehow, then check and see if it's worked:
ls -lh /dev/ crw-rw---- 1 root dialout 188, 1 Jul 12 21:08 /dev/ttyUSB1 lrwxrwxrwx 1 root root 7 Jul 12 14:41 /dev/ttyUSBIcomCat -> ttyUSB1
You're looking for something with whatever name you specified (ttyUSBIcomCat
) followed by ->
pointing to ttyUSB
something. If it's there, it worked. If it didn't ... I don't know, check the IDs or something.
WSJT-X didn't give the new symlink as an option for me. However you can just type the path in, you don't have to pick from the drop down list.
-+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-
๐ค Black Lives Matter
๐๐ค๐ Trans Rights are Human Rights
โค๏ธ๐งก๐๐๐๐ Love is Love
Copyright ยฉ 2024 Christopher M0YNG - It is forbidden to use any part of this site for crypto/NFT/AI related projects.
=> Code snippets are licenced under the Hippocratic License 3.0 (or later.)
Page generated 2024-12-13 by Complex 19
text/gemini;lang=en
This content has been proxied by September (3851b).