[Tutor] Newbie termios setup help for serial line opening.

Bill Gillespie billintucson@yahoo.com
Fri, 26 Jul 2002 18:42:50 -0700 (PDT)


Hi Folks,

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.

I've done several hours of google searches on serial comms and the set
up and opening of serial lines in unix - based on those serches - this
is what I think I should be doing....

-----------------------
1) Open the serial line
-----------------------
I do the following:

 >>>    import os
 >>>    os.open('/dev/ttyC43', 0600)

Question: is the line actually open now?

No exceptions are raised - but I do not believe the line is
actually open - as I can open it via another terminal with
a tip command to the controller that uses the line.

Question: 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.
---------------------------------------------------------------
If this is correct -
Can someone possibly walk me through the basics of setting up termios
for
a serial line that I just want to read ASCII characters off - and write
ASCII charachters to?



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

That sets up the communication so taht you can ask the device for
current settings and change them if you like. This is a first
programming project for me at work, and what I am trying to do is build
a program that will allow you to pop open a gui - and it will query
these settings and allow you to simply place new settings into a
dialogue box - or select them from a pull down menu.

Bill


__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com