- can one change tty modes for tty not stdio ?

- can one change tty modes for tty not stdio ?

Post by jbw » Fri, 19 Mar 1999 04:00:00



I gave an answer to my question :
how does one use xterm in slave mode -SccN ?

however the terminal I get has cooked I/O,
so my next question is how does one change the tty modes (to raw, -echo)
for a terminal that is not stdin ? I have both name and file descriptor.

The best answer I have requires c, and the use of termios, but
I have not yet got it to work. Is there a standard unix command for this
that I am not seeing when I use man -k ?

cheers
        beau webber

 
 
 

- can one change tty modes for tty not stdio ?

Post by Ken Pizzi » Fri, 19 Mar 1999 04:00:00



>however the terminal I get has cooked I/O,
>so my next question is how does one change the tty modes (to raw, -echo)
>for a terminal that is not stdin ? I have both name and file descriptor.

>The best answer I have requires c, and the use of termios, but
>I have not yet got it to work. Is there a standard unix command for this
>that I am not seeing when I use man -k ?

You can use stty in conjunction with the shell's file descriptor
manipulation.  For example, if you have the tty in question attached
to file descriptor number 4, you can:
   stty raw <&4
or if you want instead to use the file name /dev/tty18:
   stty raw </dev/tty18

You may want to double-check the man page for stty; some
versions of stty do their work on stdout, though most (these
days) work on their stdin.

                --Ken Pizzini

 
 
 

1. Why does STDIO buffer to a pipe, but not to a TTY?

I was trying to interactively control a program through a pipe (in the manner
of Expect), but I soon learned that any application that uses STDIO without
explicitely flushing will deadlock the pipe. The answer was to use a
pseudo-TTY. That also fixes the problem of talking to programs like SSH which
will try to read and write directly to the controlling TTY instead of to the
stdin/stdout.

The question is, how does the pseudo tty make a difference? If the application
under control does not know the difference, then how does the ptty help. As far
as I know there is no way to force the slave to flush its buffers.

I'm asking this for just my general knowledge. I got my application to work,
but my initial reasoning for why it works no longer makes sense to me. I think
that maybe I might be misunderstanding the original pipe problem and perhaps my
switching to a pty solved the problem, but not for the reason I explained above.

Yours,
Noah

2. can't open device when reboot on solaris8

3. Getting the real tty device name (/dev/tty not good enough)

4. Question about Diamond Viper Card

5. can't change tty modes w/ Sun3 tcsh 6.03.00

6. DSL, Cisco 675, and bridging. Can't get to internet.

7. BSD vs. SVR4 typehead flush after tty mode change

8. help. crc error

9. How to map a tty port to another tty port

10. creating tty's, mknod, stuck after boot with wrong tty - help

11. problems with tty, U469036 - bos.rte.tty.4.3.2.9

12. tty, tty... where art thou ...?

13. tty problem: only root and non-X get tty!