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
1
vote
1 answer

using termios - Cannot set parity to even, get EINVAL error

Summary: I am currently working on a program on embedded Linux using termios. If I do not enable even parity, my program works fine. I start to have issues when I set PARENB active and PARODD inactive. My program is designed to be 8E1 at 115200…
Victor.Wiedemann
  • 178
  • 1
  • 12
1
vote
1 answer

Serial socket - ignore POLLHUP received in non-canonical mode?

I have a Raspberry Pi connected via UART to a microcontroller. The code on the RPI is trying to read incoming non-canonical UART data, but randomly receives POLLHUP. I have been able to recover by closing and reopening the file, but this is less…
Fadeway
  • 549
  • 5
  • 18
1
vote
1 answer

How to detect USB cable disconnect in blocking read() call?

I have a smart energy meter which sends energy consumption data every second. The daemon program I've written (C++/C Arch Linux) to read the data doesn't exit when the USB cable is disconnected and stalls indefinitely in the blocking read()…
apohl
  • 11
  • 3
1
vote
2 answers

I cannot use termios.h in cygwin64

I am making an application where I think I will need to use termios.h But I have windows 10. I installed cygwin64. I type in gcc test.c -o test.exe in the terminal. I still get fatal error: termios.h: No such file or directory #include
dareesome
  • 133
  • 1
  • 7
1
vote
0 answers

Can printf() be made SMP safe?

I'm trying to get RTEMS running using SMP on a Leon3/gr712rc (2 cores). I have it partially running, but it crashes intermittently on printf's. Can anyone tell me if there's a way to make printf() SMP safe? printf appears to use termios which uses…
Symmetric
  • 4,013
  • 3
  • 27
  • 33
1
vote
1 answer

What can't getpass take input from stdin?

#include #include int main() { char *password = getpass("Password: "); puts(password); return 0; } I see that getpass can not take input from stdin. $ ./getpass <<< abc Password: xxx It seems that this is related…
user15483624
1
vote
1 answer

Canonical serial reading using terminos fail?

I am trying to read lines of datas comming from my arduino using serial. My arduino code look like that : Serial3.print(Z, 2);Serial3.print(F(";"));Serial3.println(F("END\n")); And this is my code to read the data on ubuntu : void setup(){ //set…
planktos
  • 153
  • 1
  • 7
1
vote
1 answer

Python 3.8.0 Weird printing bug

I have a very weird print() bug while using Threads and Termios. I have a repeating Thread catching a key via Termios while printing some stuff. But always it prints a new line it doesn't start at the beginning of the line but where the last line…
Noxmain
  • 13
  • 2
1
vote
0 answers

Serial communication over RS-232 stops after a while, can't transfer data, why?

I am trying to communicate between a special board(details below) and my notebook with RS-232 protocol over USB to TTL converters (datasheet). I use GtkTerm(version 1.0) on my notebook. On board I use minicom(version 2.7). I can send data at the…
Muhammed Kılıç
  • 1,271
  • 1
  • 7
  • 21
1
vote
1 answer

How do I fix socat to work properly on MacOs?

I've tried the Homebrew version of socat on MacOs Mojave and it fails to work when run with: socat STDIO,raw TCP:localhost:40707 This gives the error: tcsetattr(7, TCSADRAIN, 0x10457ad30): Device not configured Without the raw it works fine,…
Keeely
  • 895
  • 9
  • 21
1
vote
1 answer

Backspace(\b) not clearing text in Non-canonical mode termios

i am trying to clear text by pressing the backspace key, i am using termios in non canonical mode. i have created a conditional statement that when the users press backspace it should remove the previous character by going one character back. But…
Osama Xäwãñz
  • 437
  • 2
  • 8
  • 21
1
vote
0 answers

Termios behave differently in Ubuntu 18.04 and 19.04

The following code behaves differently in Ubuntu 18.04 and 19.04. In 18.04 the computer waits for input of the string as it should. In 19.04 the computer does not wait and terminates (but shouldn't). It appears to be affected by the previous code…
programmer
  • 41
  • 6
1
vote
0 answers

RTEMS without /dev/console

I'm working on an (old) application used since many years, based on RTEMS 4.6.2. Everything well, but now I've to made some changes to test a demo: I need to use an RS232 interface to communicate with another 3rd party board. Unfortunately, our…
Andre
  • 186
  • 11
1
vote
1 answer

File descriptor is in blocking mode, but read() is not blocking

I am writing some software to handle serial port read/writing for a Beaglebone system. The OS is Debian 9. I am writing code in C with --std=gnu99. Here is my code: // reference // https://www.cmrr.umn.edu/~strupp/serial.html #include…
FreelanceConsultant
  • 13,167
  • 27
  • 115
  • 225
1
vote
1 answer

Starting localstack fails - missing termios

termios appears to be a Python module required for localstack. Installing on my Windows machine using pip fails. Further research reveals this is only available on UNIX systems. What is the Windows workaround? I prefer to not go the Docker route…
BillZ
  • 127
  • 2
  • 7