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
6
votes
4 answers

Including and in the same project

What I want to achieve: I want to set custom baud rate values for some tty*-like UART-mapped terminals. How: The only way I found by far is to use the struct termios2 structure which is located in header (as mentioned here, first…
mariusmmg2
  • 713
  • 18
  • 37
6
votes
1 answer

Uart 16c950 linux speed above B4000000 (4Mbps)

everybody, i'm working with a high speed RS422 pci board (OXPCIe958) under Ubuntu. The device can work up to 15Mbps. I need to work at 10Mbps, but i notice that under Linux, if we use termois, the maximum speed that can be specified is B4000000 (4…
fdaniii
  • 95
  • 5
6
votes
2 answers

Linux termios modifying first character after serial port read()

My termios setup is modifying the first character read from the serial port using read(). I have a microcontroller talking to a linux box. The microcontroller responds to commands sent from the linux machine. The setup is as…
6
votes
3 answers

Reading from COM port in Java, Error 0x5 at ..\rxtx\src\termios.c(892)

I'm writing a small app in Java to read from COM port, and since we use 64 bit systems I had to use RXTX. The problem is when I try to run my app I get the following error: "Error 0x5 at ..\rxtx\src\termios.c(892):Access Denied" Tried my code and…
Sin5k4
  • 1,556
  • 7
  • 33
  • 57
5
votes
2 answers

reading serial port blocks for unknown reason

I am trying to interface a contact-less smart card reader over UART (usbserial) using termios framework under Linux. The code works fine on the PC, but when I cross-compile and try it out on an ARM9 target, it is able to open the device and even…
aditya
  • 952
  • 3
  • 16
  • 33
5
votes
1 answer

How to set Inter-Byte Delay Timeout to milliseconds?

I'm currently working with termios for serial communication in Linux. I need to set an intercharacter timeout to 5ms. I found a way to set intercharacter timeout using VMIN and VTIME where VMIN has to be VMIN > 0 and VTIME > 0. The problem is that…
user9544895
5
votes
2 answers

Linux: Pipe into Python (ncurses) script, stdin and termios

Apparently this is almost a duplicate of "Bad pipe filedescriptor when reading from stdin in python - Stack Overflow"; however, I believe this case is slightly more complicated (and it is not Windows specific, as the conclusion of that thread was).…
sdaau
  • 36,975
  • 46
  • 198
  • 278
5
votes
2 answers

Linux tty port spontaneously sends data upon opening

When opening an FDTI USB UART based serial port plugged into the USB host of an ARM9 based embedded board, it spontaneously transmits data. It does this right upon opening, even before the bit rate has been set, or anything else has been done to the…
Robert
  • 321
  • 2
  • 9
5
votes
2 answers

How to make arrow keys and backspace work correctly when asking input from user in C program using termios.h?

So I have the following code which basically just reads characters user inputs and prints them until 'q' is entered. #include #include #include #include int main(void) { char c; static struct…
JZ555
  • 617
  • 2
  • 7
  • 16
5
votes
3 answers

Any way to process escape key in canonical mode?

In unix plain C termios programming, if I am using canonical mode to receive a line of input from the user, how can I process the escape key? In general, if the user is entering a line of text and presses escape nothing happens. I would like to…
Tyler Durden
  • 11,156
  • 9
  • 64
  • 126
5
votes
1 answer

How to properly set up serial communication on Linux

I'm attempting to read and write data from and to an FPGA board. The board itself came with a driver that create a terminal device called ttyUSB0 whenever the board is plugged in. On the FPGA, an asynchronous receiver and transmitter were…
sj755
  • 3,944
  • 14
  • 59
  • 79
4
votes
4 answers

When setting terminal attributes via tcsetattr(fd.....), can fd be either stdout or stdin?

I have been looking int the man 3 tcgetattr (as I want to change the terminal settings in a program) and found this. int tcgetattr(int fd, struct termios *termios_p); int tcsetattr(int fd, int optional_actions, const struct termios…
humanityANDpeace
  • 4,350
  • 3
  • 37
  • 63
4
votes
2 answers

How are flags represented in the termios library?

I'm new to C and driver programming. Currently, I'm programming a user space driver to communicate with RS232 over USB using Debian. While researching, I came across the following bit of code. tty.c_cflag &= ~PARENB; // No…
TolkienWASP
  • 309
  • 1
  • 3
  • 10
4
votes
1 answer

Using termios in Swift

Now that we've reached Swift 2.0, I've decided to convert my, as yet unfinished, OS X app to Swift. Making progress but I've run into some issues with using termios and could use some clarification and advice. The termios struct is treated as a…
psmythirl
  • 309
  • 3
  • 11
4
votes
0 answers

Wrong order of bytes received from serial port

I have a device with FPGA which sends data via simple UART. The data is a packet of 32 bytes, baudrate is 115200. I connect them to my laptop via UART-TTL/USB adapter, so in system (Ubuntu 14.04) I can read the data from ttyUSB. I've made a simple…
Jakub Rakus
  • 292
  • 1
  • 11
  • 20
1
2
3
20 21