I have a problem with serial ports (usually “virtual ones” or USB←→serial port dongles) – I have too many of them, and I usually end up with the wrong one. And selecting a TrueRNG serial port and connecting a terminal emulator to it gets very messy very quickly.
So I was searching around, semi-idly wondering if I could somehow build a device name to USB name mapping that I could stuff into rofi (or dmenu) and I discovered the /dev/serial/by-id/ which did 99% of the work for me.
So yes, I can invoke kermit and up will pop a menu allowing me to select which serial port to connect to :-
ls /dev/serial/by-id |\
rofi -dmenu -l 20 -p "Pick a serial device" -font "mono 20"
That is the core of it, but to make it functional I need to embed it into a command line argument to kermit :-
alias kermit='kermit -C "set line /dev/serial/by-id/$(ls /dev/serial/by-id | rofi -dmenu -l 20 -p "Pick a serial device" -font "mono 20"),set carrier-watch off"'
Which is admittedly a bit of a mouthful!
But so useful if you have two or three USB to serial adopters plugged in plus a switch’s console port and a Linux widget that provides a serial console.