Reading from serial port & writing to X console

Grant Edwards grante at visi.com
Thu Jul 17 12:24:56 EDT 2003


In article <mailman.1058453987.15227.python-list at python.org>, lec wrote:

> I'm trying to write a program to read from the serial port &
> write whatever that is read to the X console (/dev/tty7). For X
> to recognize the characters sent, I believe you have to send
> "scancodes".

No.  You can simply read /dev/ttyS0 and write to /dev/tty7:

In shell:

 $ (stty 9600 -paren -ixon -ixoff; cat) </dev/ttyS0 >/dev/tty7

Change the stty parameters as desired.

In Python, just open /dev/ttyS0, /dev/tty7.  Read from one and
write to the other.  

There are a couple different serial port modules that wrap up
serial ports into objects to hide the nasty termios stuff.

Google the group for terms like PosixSeral PySerial.

-- 
Grant Edwards                   grante             Yow!  Why was I BORN?
                                  at               
                               visi.com            




More information about the Python-list mailing list