Checking for the status of a device (before connection)... -- (John McCormick)

Mike Meyer mwm at mired.org
Tue Apr 12 00:35:48 EDT 2005


Mccormick.Johnw at epamail.epa.gov writes:

> Hello, ... I am John McCormick (Systems Programmer ) and I am currently
> working on a python program which will connect (user) specified inputs
> and connect them to (user) selected outputs (like screen or
> video/audio-recording devices) and would like to know if there's a
> technique to "test" or "sense" if the desired output device is busy
> without interrupting the output device while checking to see if it's
> busy... ?? If, perhaps, python does not have this type of feature, I
> wonder if you could give me some type of direction (ie., manufacturer's
> device response checking techniques that could be used in conjunction
> with python) but the bottom line is not to "crash" or interrupt the
> desired output device (if it's still busy)...

That's a very device - and platform! - specific thing to want to
do. On Unix, you would typically open() the /dev/device file and
perform an ioctl on it to see if it was busy - assuming it supported
that kind of operation at all. The exact ioctl call would depend on
the device, as there really isn't a standard for them.

    <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list