Questions tagged [termios]

Termios is Unix API for terminal I/O.

The anatomy of a program performing serial I/O with the help of termios is as follows:

  • Open serial device with standard Unix system call open(2)

  • Configure communication parameters and other interface properties (line discipline, etc.) with the help of specific termios functions and data structures.

  • Use standard Unix system calls read(2) and write(2) for reading from, and writing to the serial interface. Related system calls like readv(2) and writev(2) can be used, too. Multiple I/O techniques, like blocking, non-blocking, asynchronous I/O (select(2) or poll(2)) or signal-drive I/O (SIGIO signal) are also possible.

  • Close device with the standard Unix system call close(2) when done.

309 questions
2
votes
1 answer

Handling escape sequences in a Telnet session

I'm borrowing a short C code that establishes a telnet session using a child-parent scheme and handles the communication between both processes through a pseudo terminal device. The code runs pretty fine but with one major flaw, the telnet process…
Marcel Hernandez
  • 1,371
  • 13
  • 22
2
votes
4 answers

Why is serial port skipping data when sending data?

I have written some C++ code to talk to my arduino via serial. It just tries to make oscillations on two servo motors using sine and cosine, but it is skipping data. I'm not sure why this is happening. I am using the termios.h for the serial…
mightcouldb1
  • 649
  • 2
  • 8
  • 14
2
votes
2 answers

Command-line configurating a TTY device

My task at the moment is to port a driver for some 16550-compatible chip from QNX to Linux. The chip provides several UARTs, each one seen as a standard 16550 serial port, albeit with some extensions. Now, in QNX, the whole device driver is packed…
user1284631
  • 4,446
  • 36
  • 61
2
votes
1 answer

How echo input characters again after turning off echoing?

I have this code which is meant to hide my password at login screen of terminal. After login, the input all is still blank. How do I set it to normal like back to default after getline is done? #include #include #include…
baoky chen
  • 799
  • 2
  • 11
  • 20
2
votes
1 answer

Attempting to install termios gem results in make errors

I'm attempting to install the termios gem on OS X 10.7 with ruby 1.9.3-p194. It used to install fine, but now, even when i try to install it in 1.9.3-p125, i get the same errors: https://gist.github.com/83a4ff80fa882dcd6937 Any help would be greatly…
paradox460
  • 174
  • 1
  • 11
1
vote
0 answers

Does VTIME and VMIN serial port options work with select?

I have Linux program that reads a serial port by using select() and read(). It works fine, but there is a performance problem: Program receives data only 1-4 bytes per single read() call. And that causes unnecessary overhead. I set VTIME to 20 (2…
SKi
  • 8,007
  • 2
  • 26
  • 57
1
vote
1 answer

Check for extra characters in Linux terminal buffer

I try to implement getch() function in Python, which should also return list of chars for special keys like F1-F12 and arrow keys. These special keys generate several chars in a sequence. Therefore getch() reads one char in blocking mode and then…
anatoly techtonik
  • 19,847
  • 9
  • 124
  • 140
1
vote
2 answers

read() on stdin returning EOF instead of waiting for input

Does anyone know why running the following code may cause all future read() calls on that fd (which is stdin) to immediately return 0 instead of blocking for input? termios newTerminalSettings; tcgetattr(inFd,…
Pavel
  • 5,320
  • 8
  • 35
  • 45
1
vote
0 answers

STDIN dup2 for OpenBSD/NetBSD

I have a child using dup2: case OPGAME: users[userid]->userNextEntry = redirectuser( userid, 0, USERMODULES[MENU] ); pid = fork(); if ( pid == -1 ) parseerror( SYSTEMERROR ); users[userid]->userChildPID = pid; if (…
1
vote
0 answers

Why does a call to read() hang waiting for a newline (C)?

Consider this program (a basic implementation of cat): #include #include #include #include int main() { char buffer[4096]; ssize_t bytes_read; while ( ( bytes_read = read(STDIN_FILENO, buffer, sizeof…
user129393192
  • 797
  • 1
  • 8
1
vote
1 answer

What signals does clearing the ISIG flag in termios struct disable?

The Open Group's man page for termios.h specifies nothing: ISIG Enable signals. The OpenBSD's man page for termios.h specfies: ISIG /* enable signals INTR, QUIT, [D]SUSP */ While the Linux's man page for termios.h specifies: ISIG When any of the…
Harith
  • 4,663
  • 1
  • 5
  • 20
1
vote
0 answers

How to understand the following quote from termios description

I'm using Mac (10.14.6), following quote is from man termios: When a controlling terminal becomes associated with a session, its foreground process group is set to the process group of the session leader. To verify this, I opened a terminal…
mzoz
  • 1,273
  • 1
  • 14
  • 28
1
vote
0 answers

Is termios supported in msys2? If not, is there a portable way of getting unbuffered I/O?

The following code works on linux: include using namespace std; static struct termios old_terminal_settings; void setterm() { tcgetattr(STDIN_FILENO, &old_terminal_settings); // Set terminal to unbuffered input mode struct…
Dov
  • 8,000
  • 8
  • 46
  • 75
1
vote
0 answers

No module named 'termios' when creating a DAG on Airflow Docker

I am trying to create a sample DAG on VSCode after installing Airflow through docker but I run into this error. ModuleNotFoundError*: No module named 'termios'* Wondering what went wrong with my installation? I installed a docker environment for…
tsukikosagi
  • 103
  • 1
  • 8
1
vote
3 answers

Why do tmux and vim print garbage in my SSH wrapper script?

I have written an SSH wrapper script that does local line editing. It is invoked similarly to SSH. For example: python3 sshwrapper.py user@example.com -CX. The problem is that when I connect to a remote computer using this script and use vim or tmux…
Flux
  • 9,805
  • 5
  • 46
  • 92