Questions tagged [tty]

For questions related to terminal drivers and the behaviour of terminals for Unix and related systems.

The tag should be used for questions related to terminal drivers and the behaviour of terminals for Unix and related systems (Linux, BSD, Solaris, AIX, HP-UX, MacOS X, etc). Sometimes, this is related to or or .

Example questions:

972 questions
6
votes
1 answer

Tell if STDOUT of Perl Script is redirected

So I wrote a simple html 1.0 server, and I have some perl scripts on the server. In particular, I have this script called my histogram, that is an html form with a form action equal another cgi file. Here's the code: print "
KrisSodroski
  • 2,796
  • 3
  • 24
  • 39
6
votes
2 answers

Ctrl-c stopped working in cygwin

Ctrl-c (SIGINT/SIGTERM) stopped working in cygwin. If I recall, this might have something to do with TTY settings. Please advise on how to get it working again. I did not change anything intentionally Output from stty -a: $ stty -a speed 38400 baud;…
MetaChrome
  • 3,210
  • 6
  • 31
  • 48
5
votes
2 answers

C Fork a new tty

I have to create a new pair of tty (master and slave) without using forkpty(). In the man of pts(4), it is written that : When a process opens /dev/ptmx, it gets a file descriptor for a pseudo-terminal master (PTM), and a pseudo-terminal slave…
Jeffrey Muller
  • 850
  • 1
  • 15
  • 28
5
votes
2 answers

Where does this \r\n come from when I redirect STDOUT to a PTY in Perl?

With the following code: use strict; use warnings; use utf8; use IO::Pty; use Data::Dump qw(pp); my $pty = IO::Pty->new; open *STDOUT, '>&', $pty->slave; if ( my $pid = open *STDOUT, '|-' ) { # parent my $str = "foo\n"; print {*STDERR}…
André Kugland
  • 855
  • 8
  • 20
5
votes
2 answers

How i can read tty file with timeout?

I have tty device in /dev , where I send AT commands. I want to read line by line and stop reading file after timeout.
Denys Rogovchenko
  • 191
  • 1
  • 2
  • 7
5
votes
1 answer

How do you write to a pty master Rust

I have created a simple pty setup, however I am unsure on how to actually write to the master or slave sides once it is created. I am also unsure if my setup is correct, because upon inspection, the Stdin, Stdout, and Stderr of the child process for…
Ethalot
  • 57
  • 6
5
votes
1 answer

How tty driver interacts with UART driver during read/write opetations?

I am working on modification/development of a SDIO UART driver. And would like to know: How tty driver interacts with UART driver during read/write operations? I am interested in buffer management. I searched over net, however did not find…
TheCottonSilk
  • 8,662
  • 2
  • 26
  • 37
5
votes
1 answer

What causes this Scala program to become suspended due to tty output when run in the background?

Suppose we have the following Scala (2.12). It is using ProcessBuilder to execute a very trivial set of commands (a sleep, followed by an echo). The program also captures both stdout and stderr, and prints all lines - with those respective…
Jeff Evans
  • 1,257
  • 1
  • 15
  • 31
5
votes
1 answer

What does pl2303 "error sending break" mean?

I have a problem with my pl2303 converter. I'm using two of them like this: LAPTOP <-USB-SERIAL-> <-SERIAL-SERIAL-> <-SERIAL-USB-> RASPBERRYPI In other words, I'm connecting Raspberry Pi with my laptop using two usb-to-serial converters and having…
5
votes
1 answer

Connect usb scale in Ubuntu, cdc_acm says failed to set dtr/trs

I am trying to connect an scale (Dibal series 400) in Linux (Ubuntu), and I can not succeed. The scale works on Windows after installing a driver to enable a Virtual Com Port, but when I plug in the scale in Linux, it tries to start, but after a…
bracana
  • 1,003
  • 2
  • 11
  • 20
5
votes
2 answers

How detect assigned terminal device for interactive work

I am writing pager pspg. There I have to solve following issue. After reading from stdin I should to reassign stdin from previous reading from pipe to reading from terminal. I used freopen("/dev/tty", "r", stdin) But it doesn't work, when pager…
Pavel Stehule
  • 42,331
  • 5
  • 91
  • 94
5
votes
1 answer

what's the relationship between /dev/tty and stdin/stdout/stderr?

I know they have different file descriptors, stdxx can be redirected. int tty_fd = open("/dev/tty", O_RDWR); So, what's the difference in the codes below(stdxx not redirected): n = read(tty_fd, buf, sizeof(buf)); n = read(STDIN_FILENO, buf,…
Lubin
  • 55
  • 5
5
votes
1 answer

Python: How can I use GNU readline when the value of sys.stdin has been changed?

I want my Python program to take input from a pipe and later take input from the terminal. After reading this SO post, I tried opening /dev/tty to replace sys.stdin. import sys import readline def tty_input(prompt): with open("/dev/tty") as…
Wren
  • 123
  • 2
  • 4
5
votes
1 answer

File which responds to isatty(3)

I'm wanting to write my own psuedo-shell and would like to get pretty colors etc. How do I go about tricking a subprocess into thinking that it is in a TTY? I've read about virtual TTY's but haven't found much practical information about how to…
Chris Lloyd
  • 12,100
  • 7
  • 36
  • 32
5
votes
1 answer

Listen for terminal session "close" event

In a terminal I start a background process A, which in turn starts a process B. Process B writes to the terminal (process A has passed B the correct TTY file descriptor). What I am afraid of, is if the user (in some cases, me) closes the terminal…
Alexander Mills
  • 90,741
  • 139
  • 482
  • 817