I am in the middle of a project that requires me to send and retrieve
information from a machine connected to a serial port. My problems are
these:<br>
<br>
1. I cannot send control characters<br>
2. I cannot read data streaming from the serial port<br>
<br>
<br>
I have been doing fine with:<br>
<br>
os.system("echo '5' >/dev/tty00")<br>
os.system("echo '8' >/dev/tty00")<br>
<br>
<br>
and the like to the remote machine, but I need to be able to send
control characters the same way to scroll through menus. I have tried
pyserial and pexpect with mixed (mostly horrible) results (not the fault of the module builders!), thus far the
simple act of echoing the strings to the serial port is the only
reliable method I have found.<br>
<br>
Reading from the serial port has also been problematic. I find that
simply opening the port /dev/tty00 file and using readlines(), read()
or whatever gives me empty strings or lists. Pbth.<br>
<br>
So first: how should I go about adding the hex escape sequences (\x0a and \x50) to the above strings in their raw form?<br>
second: what method should I use to read a raw stream from the serial port for a given period?<br>
<br>
I have looked carefully at the neat and tidy miniterm.py example in the
pyserial examples directory, and see how one can continuously read via
a thread from the port, but have not been able to replicate it thus far.<br>
<br>
Any help whatsoever would be great! I'm beginning to feel a little lightheaded. Thanks!<br>
<br>
<br>
<br>