[Tutor] pyserial question
Stanfield, Vicki {D167~Indianapolis}
VICKI.STANFIELD at ROCHE.COM
Tue Sep 23 14:37:49 EDT 2003
Actually this functionality is just what I need, but it doesn't work in my application (always returns 0). I am using an infrared dongle, does that not meet your second spec of using a cable that actually carries the signals? If not, how can I accomplish the same thing with a read or write or something else?
--vicki
-----Original Message-----
From: Lloyd Kvam [mailto:pythontutor at venix.com]
Sent: Tuesday, September 23, 2003 10:45 AM
To: Vicki Stanfield
Cc: tutor at python.org
Subject: Re: [Tutor] pyserial question
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
_______________________________________________
Tutor maillist - Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list