Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

BOFH excuse #220: Someone thought The Big Red Button was a light switch.


comp / comp.lang.tcl / Re: How do I to detect ACTIVE serial communications ports in Linux?

SubjectAuthor
* How do I to detect ACTIVE serial communications ports in Linux?tcl
`- Re: How do I to detect ACTIVE serial communications ports in Linux?Scott Pitcher

1
Subject: How do I to detect ACTIVE serial communications ports in Linux?
From: tcl@use.invalid
Newsgroups: comp.lang.tcl
Date: Fri, 14 Jun 2024 21:51 UTC
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: tcl@use.invalid
Newsgroups: comp.lang.tcl
Subject: How do I to detect ACTIVE serial communications ports in Linux?
Date: Fri, 14 Jun 2024 14:51:28 -0700
Lines: 8
Message-ID: <ld3sb0Fm1o7U1@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: individual.net 5ll7LL3N39WJY+KUWu6h2wM0vTpjhQ1CR0STHFq+laYD6ZRRrq
Cancel-Lock: sha1:aUWHztYgDvc8IZZRhhKk/xAboBI= sha256:ueN3H2UOJHQ9hpOOziGqJPY/rHi6l07FCPBodGUiwzc=
User-Agent: ForteAgent/8.00.32.1272
View all headers

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.

Subject: Re: How do I to detect ACTIVE serial communications ports in Linux?
From: Scott Pitcher
Newsgroups: comp.lang.tcl
Organization: SVP TECHNICAL SERVICES
Date: Wed, 19 Jun 2024 05:55 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: scotty@svptechnicalservices.com.au (Scott Pitcher)
Newsgroups: comp.lang.tcl
Subject: Re: How do I to detect ACTIVE serial communications ports in Linux?
Date: Wed, 19 Jun 2024 15:55:25 +1000
Organization: SVP TECHNICAL SERVICES
Lines: 51
Message-ID: <20240619155514.0de69cf3@officepc>
References: <ld3sb0Fm1o7U1@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 19 Jun 2024 07:55:27 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="03af1b289d35786ddf12eefeeb5b1710";
logging-data="1907419"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+A7oO72sqVnQTG+LfVssVJwkfTdRRRZ7Q="
Cancel-Lock: sha1:OsHlqM8zWVktLKeejV/CsXIM23s=
X-Newsreader: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu)
View all headers

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

1

rocksolid light 0.9.8
clearnet tor