Another stty question.

Another stty question.

Post by Laurence Lindstro » Thu, 13 Mar 1997 04:00:00



Monday, I posted a question relating to the following:  

I'm trying to use stty to set the values of a terminal that I then
want to open with an application I've written.  

   I "stty blablabla < /dev/tty00" and when I then look at it with
"stty -a < /dev/tty00", it's values are as they were before my first
stty.  

   Several people have told me that this is the way it's supposed
to work.  As I now understand it, the stty opens the port and sets
it's values, but closes the port, undoing the changes, when it
exits.  

   I've looked at the man page for stty, and I just don't get it.  

   Is there a way to set a port's values, then open that port in
an app while preserving those values, and set additional values
with tcsetattr?  

   I've been contracted to do a small project.  I would like the
user to change the com port values without setting entries for
tcsetattr, and then recompiling.  My client wants this program to
be portable between Solaris to DOS, and I want to minimize the
volume of code in conditional compile clauses.  

                                                          Thanks
                                                          Larry

 
 
 

Another stty question.

Post by Andrew Gabri » Thu, 13 Mar 1997 04:00:00




Quote:>Monday, I posted a question relating to the following:  

>I'm trying to use stty to set the values of a terminal that I then
>want to open with an application I've written.  

>   I "stty blablabla < /dev/tty00" and when I then look at it with
>"stty -a < /dev/tty00", it's values are as they were before my first
>stty.  

>   Several people have told me that this is the way it's supposed
>to work.  As I now understand it, the stty opens the port and sets
>it's values, but closes the port, undoing the changes, when it
>exits.  

>   I've looked at the man page for stty, and I just don't get it.  

Probably happens on the last close(), i.e. when stty exits.

Quote:

>   Is there a way to set a port's values, then open that port in
>an app while preserving those values, and set additional values
>with tcsetattr?  

You could try opening the port first, then forking off an stty
with stdin already open on the port.
No idea if it will work, but that can't be too far off the effect
of running stty from a shell, and the results persisting afterwards.

--



 
 
 

Another stty question.

Post by srln.. » Sun, 16 Mar 1997 04:00:00




>I'm trying to use stty to set the values of a terminal that I then
>want to open with an application I've written.  

>   I "stty blablabla < /dev/tty00" and when I then look at it with
>"stty -a < /dev/tty00", it's values are as they were before my first
>stty.  
..
>   Is there a way to set a port's values, then open that port in
>an app while preserving those values, and set additional values
>with tcsetattr?  

This is what I have done to run an application that required specific
serial port settings...

#!/bin/sh

PORT=/dev/term/b
STTYSTUFF="igncr"

# start a background process that keeps the port open

( while true ; do ( sleep 60 ) ; done ) < $PORT > /dev/null 2> /dev/null &

# remember the process id of the above so we can kill it on exit from this

TRAPPID=$!
trap "kill -15 $TRAPPID" 0

# configure the port

stty $STTYSTUFF < $PORT

# run application

your_app_name

exit 0

--
Roger Williams, Institute of Geological & Nuclear Sciences, New Zealand

 
 
 

1. Stty Question

I have a server that I remotely telnet to
(bsdi 2.0) for administration purposes.
The problem is that every time I press a
<CR> during the session,  I get the

every line. I tried various stty commands such

fix the problem.

I am using Lan workplace for Windows as the
telnet software. I also do not have the problem
if I login directly to the server.

Thanks in advance,

Amy

2. Please Repost Term-HOWTO(short)

3. stty question

4. Svga server doesn't load

5. capturing tty

6. process accounting uner 1.0 [q]

7. An stty question

8. Another stty question....

9. stty questions

10. Stty questions for serial port modem

11. Newbie stty question