Newbie - help request with serial line (termios?) setup in Python 2.2
Bill Gillespie
billintucson at yahoo.com
Sat Jul 27 14:04:29 EDT 2002
Hi,
I'm trying to open a serial line on a SunOs using python 2.2.
I'm new to programming, and fairly new to unix/linux. I have the two
pink Oreilly Python books and have read a couple of tutorials - but I
am a newbie.
After much googling (there is not a lot of novice python/unix/termios
info out there) - this is what I think? I should be doing....
Open the line
Configure the line? termios??
Communicate with the line (ASCII charachters < > at 4800)
Close the line
-----------------------
1) Open the serial line
-----------------------
I do the following:
>>> import os
>>> os.open('/dev/ttyC43', 0600)
Is the serial line actually open now? No exceptions are raised - but I
do not believe the line is actually open - because I can open it via
another terminal witha "tip" command to the controller that uses the
line.
What is the 0600 integer value and what is it for?
---------------------------------------------------------------
2.) Next I've read that I have to set up the line using termios.
---------------------------------------------------------------
Can someone possibly walk me through the basics of setting up termios
for a serial line with python 2.2.
I just want to read ASCII characters off - and write ASCII charachters
to this serial line - Is termios even needed? Or can the whole
intration be done with out "the termios low level" - level of
interaction?
Some supplemental notes:
------------------------
The serial line accesses a controller that controls two other devices.
The normal way to interact with the controller is to use the commands:
sun> tip oftc (the controller is programmed in Fourth I
think)
That sets up the communication so that you can ask the device for
current settings - it telle you the values, and you can issue commands
to change them if you like. To close I use "$." as the EOF.
Thanks for any help!
Bill
More information about the Python-list
mailing list