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

Serial communication on Linux with flow control enabled - bad behaviour

I wrote common functions in order to manage serial ports, based on the following structure: typedef struct { int PHandle; unsigned int Port; unsigned int BaudRate; unsigned char Parity; unsigned char FlowControl; …
ogs
  • 1,139
  • 8
  • 19
  • 42
2
votes
1 answer

Can't disable escape echoing even with the echoing turned off

I'm trying to make a more-like application where the user's inputs are recorded but not printed. So I've turned off echoing, and turned off canonical mode to process inputs immediately. Here's the code for this: struct termios oflags,…
Kurt
  • 75
  • 8
2
votes
1 answer

How do you read the arrow keys?

Extensive searching on the use of raw mode with termios and xterm leads to numerous references to a "timing trick" required to distinguish between an escape-sequence and a lone appearance of the escape character. So how do you do it? I don't want to…
luser droog
  • 18,988
  • 3
  • 53
  • 105
2
votes
1 answer

Understanding UNIX termios VMIN and VTIME

I am currently working on a simple serial interface on a UNIX based device and cant find a definitive answer to the following: I am currently trying to determine if a 'pure time read' (VMIN = 0, VTIME >0) will return half way through reading to…
Ben Turner
  • 725
  • 1
  • 6
  • 23
2
votes
2 answers

How long is a serial buffer in linux?

My question regards . As I understand, two buffers exist in reading something over a UART - a hardware buffer where received bytes are stored, and a software buffer where we load the stuff that has been stored in the hardware buffer. This…
space_voyager
  • 1,984
  • 3
  • 20
  • 31
2
votes
1 answer

gcc linux - 'CRTSCTS' 'ECHOCTL' undeclared (termios.h)

I am trying to compile a static library which uses serial communications on Linux, and it fails with the following errors: gcc -o out/linux/x86_64/release/service/protocol-plugin/plugins/ble/lib/bluegiga/uart.o -c -std=gnu99 -Wall -ggdb -fPIC -Os…
eliba
  • 140
  • 10
2
votes
0 answers

Open tty Serial USB port

I am using Sierra Aircard modem While Configuring Dial Port/PPP port ,I am opening This port(deb/ttyUSB3) like this struct termios tio; memset(&tio, 0, sizeof(termios)); if ((fdDataPort = open(portName, O_RDWR | O_NOCTTY| O_SYNC | O_NONBLOCK…
Gajukorse
  • 147
  • 2
  • 11
2
votes
1 answer

Serial port in c++ , Unix

I wrote a code to connect, throught a serial port, mi computer to arduino. This is arduino's code: #include Servo servo; const int pinServo = 2; unsigned int angle; void setup() { Serial.begin(9600); servo.attach(pinServo); …
Dadda Barba
  • 145
  • 2
  • 9
2
votes
1 answer

Opening a serial port on OS X hangs forever without O_NONBLOCK flag

I have a serial to USB converter (FTDI, drivers installed from http://www.ftdichip.com/Drivers/VCP.htm) connecting a serial device to a MacBook Air. It shows up on the MacBook as both /dev/cu.usbserial-A4017CQY and /dev/tty.usbserial-A4017CQY. All…
Eric Dand
  • 1,106
  • 13
  • 37
2
votes
1 answer

asynchronous serial transmission C

So i'm working on a program, wich is vaguely going to resemble Br@y's Terminal, but running from the commandline in linux It will do asynchronous transmission, out the serial (Com) port. Now i think the Header/library i need for this is the…
Frames Catherine White
  • 27,368
  • 21
  • 87
  • 137
2
votes
2 answers

Non canonical mode

What's a simple way to using backspace in non canonical mode in linux terminal ? It's part of code, when i set flags: struct termios old_tio, new_tio; /* get the terminal settings for stdin */ tcgetattr(STDIN_FILENO, &old_tio); /* we want to keep…
pandreym
  • 137
  • 1
  • 3
  • 11
2
votes
1 answer

serial port not responding

I wrote a program that communicate with serial port, using termios, this program will read serial port in non-blocking mode and write response to serial port once it read data. If there is no data read from serial port, the program will do other…
cifer
  • 615
  • 1
  • 9
  • 25
2
votes
1 answer

PARMRK termios behavior not working on Linux

I'm trying to receive messages from a device that uses mark parity for an address byte and space parity for the message body. The device is a "master" of a multi-drop serial bus. Based on the termios man page, I am using CMSPAR, PARENB, ~PARODD,…
Dan George
  • 51
  • 1
  • 6
2
votes
1 answer

How can I disable the serial port SAK option on Linux using userspace API?

I have an embedded linux setup generated using buildroot. As part of my application I have a dedicated thread that opens the serial port (/dev/ttyS0) for the purposes of listening for and replying to modbus messages. It works fine, but when my…
mathematician1975
  • 21,161
  • 6
  • 59
  • 101
2
votes
1 answer

How can I get the Python module termios to work in Cygwin?

I want to run Urwid in Windows so I downloaded and installed Cygwin (default packages only). I tried the Hello World example: import urwid txt = urwid.Text(u"Hello World") fill = urwid.Filler(txt, 'top') loop = urwid.MainLoop(fill) loop.run() but…
c00kiemonster
  • 22,241
  • 34
  • 95
  • 133