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

lumbricus@gmx.net lumbricus@gmx.net
Sat, 27 Jul 2002 18:52:39 +0200 (MEST)


> Hi Folks,

Hello!

[ snip ]

> -----------------------
> 1) Open the serial line
> -----------------------
> I do the following:
> 
>  >>>    import os
>  >>>    os.open('/dev/ttyC43', 0600)
> 
> Question: is the line actually open now?

If UNIX doesn't say anything it usually means that everything
is OK.
You can use the UNIX manpages in section 2 and 3.
man 2 open
man fopen

> 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?
The permissions of the file (here: rw-------)
man chmod 
man ls
 
> ---------------------------------------------------------------
> 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?

try read and write.
http://www.dodgies.demon.co.uk/Software/RRRR2/linux_serial.txt 
 
> 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.

man tcgetattr
man tcsetattr

> Bill

HTH, HAND
and Greetings, J"o!

-- 

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net