PySerial rereads its own data

Chris Liechti cliechti at gmx.net
Wed Jun 4 18:50:49 EDT 2003


Cliff Wells <clifford.wells at attbi.com> wrote in
news:mailman.1054711687.11581.python-list at python.org: 
> When I wrote to ttyS0 (from PySerial) the data was correctly displayed
> via the cat process.  However, if I then read from ttyS0 via PySerial
> I would get back the same data even though cat was clearly not writing
> anything.
> 
> Anyway, I've discovered since that it only happens when using cat
> (having another PySerial process doesn't have this problem).  Even
> though 'stty -F /dev/ttySn' didn't show any odd flags, I'm guessing
> that somehow some echoing was enabled. 

yes. echoing is usualy enabled because of serial terminals/consoles, i.e. 
when you run getty on the serial port, but the port is already initialized 
with these settings even if you never run getty...

you can actualy have a line editor on the serial port, so that the serial 
driver only forwards complete lines to the listening process and all that 
beacuse of the ancient serial terminals (not that they aren't usefulnowdays 
;-)

> PySerial explicitly disables
> echoing on ttyS0, so I'm guessing some default setting on ttyS1 was
> causing the data to get reflected back to ttyS0.  Not really an
> educated guess but my concern about it disappeared when I discovered I
> wouldn't be facing that problem anyway (unless I use cat in my
> production code <wink>). 

:-)

chris

-- 
Chris <cliechti at gmx.net>





More information about the Python-list mailing list