Asynchronous I/O concepts

David Gravereaux <[email protected]> Wed, 10 Jun 2026 11:37:54 -0700
Newsgroups gmane.linux.hardware.gpib.general
Message-ID <[email protected]>
Hi again,

I want to write a real channel driver for Tool Command Language to do 
I/O in the usual alterable manner as say pipes, serial, network streams, 
files, tty (console), etc..  But IEEE 488.1 is a different beast with 
its hardware lines.  Interrupts and the resultant serial poll are device 
specific.  So I'm thinking one thread per board looping on WaitSRQ() 
followed by a FindRQS() that becomes the basis of a notifier.

https://github.com/davygrvy/aGPIB/blob/master/aGPIBChan.cpp#L82

I would have to redefine what a readable event means.  It would mean a 
status byte is ready and we'd feed that directly into the readable 
fileevent procedure.

Maybe something like this for a Tektronix DM5010

proc read_dmm {chan stb} {
    switch -- $stb {
        65 {
           #power on
           puts $chan {init; acv; dig 4.5; rqs on; opc on; monitor on; 
mode run}
           }
        67 {puts "you pressed the 'inst id' key"}
        132 - 140 {
           # device has a measurement ready
           set acv [format %f [string trimright [read $chan] {;}]]
           puts ">DM5010: ${acv} Vrms"
        }
    }
}

I started on this idea like 15 years ago and now is my time to realize 
it as I have the need to automate all my gear.