(revised) test for linux serial ports


Author Message
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2541
Posted: 03:20pm 13 Dec 2024      

Volhout: probably not worth doing much more testing with live distros, i'm feeling inclined to think my whole approach is flawed! i've just sent an email off to Soren Holm, the fellow who, in 2012, posted about the method i've been using to detect ports:
https://stackoverflow.com/questions/2530096/how-to-find-all-serial-devices-ttys-ttyusb-on-linux-without-opening-them
(his posting is about 1/3 of the way down the page)

hopefully he is still about, and willing reply. clearly in kernel 6.8 some fairly major reorganizing of the serial code has been carried out, but to date i've been unable to find any online discussion on it - or indeed any other useful details.

btw, you can in fact use dmesg | grep "tty" to build a list of serial ports (removing any that are not in /dev/tty* to get rid of ones that have been subsequently unplugged), but the message buffer that dmesg reads from is of limited length and wraps around at some undefined point.


cheers,
rob   :-)