[Tutor] pyserial question
Lloyd Kvam
pythontutor at venix.com
Tue Sep 23 11:45:23 EDT 2003
I downloaded the current pyserial (1.20). I looked at the serialposix.py
file.
dev = Serial(rtscts=1,#plus other necessary parameters)
dev.getDSR() # should be true if device is turned on
dev.getCTS() # should be true if device is ready to receive data
This only works if the device actually supports hardware flow
control signalling AND if you are using a cable that actually carries
the signals.
The timeout will only affect commands that read from the device.
Vicki Stanfield wrote:
> I am still unable to figure out how to test whether or not the device on
> the other end of the serial connection is on. Is there a simple way to do
> a conditional read that times out with an error after some given amount of
> time. I am using pyserial version 1.18. When I open the port, I specify a
> timeout of 1 second, but that doesn't seem to do what I expect it to.
> Maybe I have to do something different with the write command to look for
> an error code? Right now, it is simply:
>
> port.write('\x09')
>
> I don't see anything documented.
>
>
> --vicki
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
--
Lloyd Kvam
Venix Corp.
1 Court Street, Suite 378
Lebanon, NH 03766-1358
voice: 603-443-6155
fax: 801-459-9582
More information about the Tutor
mailing list