Re: How do I to detect ACTIVE serial communications ports in Linux?

Liste des GroupesRevenir à cl tcl 
Sujet : Re: How do I to detect ACTIVE serial communications ports in Linux?
De : scotty (at) *nospam* svptechnicalservices.com.au (Scott Pitcher)
Groupes : comp.lang.tcl
Date : 19. Jun 2024, 06:55:25
Autres entêtes
Organisation : SVP TECHNICAL SERVICES
Message-ID : <20240619155514.0de69cf3@officepc>
References : 1
User-Agent : Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu)
On Fri, 14 Jun 2024 14:51:28 -0700
tcl@use.invalid wrote:

You might have come across a discussion on stackexchange but if not:
https://stackoverflow.com/questions/2530096/how-to-find-all-serial-devices-ttys-ttyusb-on-linux-without-opening-them#9914339

I implemented this code which looks in /sys/class/tty, and for each
console device checks for the existance of a device/id file. You could
also look for device/resources. Those two seem to only exist for
devices which are present on the system. I haven't confirmed how
portable this is. Certainly on this desktop is shows only ttyS0. On the
server which has no serial port it shows nothing. On the other server
it also shows only ttyS0. I haven't confirmed USB devices yet.

    proc getSystemSerialPortList {} {
variable Logkey

set result ""

set sysdir "/sys/class/tty"

if {[file exists $sysdir] && [file isdirectory $sysdir]} {
    foreach tty [glob -dir $sysdir -tails *] {
set ttydevid [file join $sysdir $tty device id]
if {[file exists $ttydevid] && [file isfile $ttydevid]} {
    lappend result $tty
}
    }
}

return $result
    }

How do I to detect ACTIVE serial communications ports in Linux?
 
 
I know about the Windows process, but don't know about the process to
find active communication ports in Linux.
 
TIA.
 



--
+---------|------------------------+
|       --+--                      |
|      ___|_____                   |
| ~~~~~\_______/~~~~~~~~~~~~~~~~~  |
+----------------------------------+d


Date Sujet#  Auteur
14 Jun 24 * How do I to detect ACTIVE serial communications ports in Linux?2tcl
19 Jun 24 `- Re: How do I to detect ACTIVE serial communications ports in Linux?1Scott Pitcher

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal