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
0
votes
1 answer

Transmission and receiving of data through serial(in C)

I'm trying to write a program where one part—and the most important part—of the program is to establish communication of transmission and reception through the serial port file "dev/ttyS2" using termios and a microship controller(Atmega169P). I am…
Jay
  • 1
  • 1
0
votes
1 answer

artifacts appearing in VT100 raw mode

considering this code: #include extern"C"{ #include #include } int main(){ termios termattr_bak; termios termattr; /* switch to raw mode*/ tcgetattr(STDIN_FILENO,&termattr_bak); termattr.c_iflag |=…
kmft3kte
  • 23
  • 6
0
votes
0 answers

termios, getchar() always returns -1 with error EAGAIN

I have a piece of code in which I want to read a character from the terminal. The goal is to give keyboard input for moving a robot. If there is no input in the terminal , the code should return -1, which it does, but even when I do give inputs, it…
S07
  • 1
  • 1
0
votes
1 answer

Ubuntu C Uart communication lost first byte

I do a new summary ,do more tests,and post herehttps://forums.developer.nvidia.com/t/jetson-nx-uart-communiation-lost-first-byte/234877 I write a uart software using c++ on Jetson Nx(Ubuntu OS) to communicate with a PC. On PC there's a uart…
0
votes
0 answers

Retrieve specific bit from a bit mask

I am using the termios library and I am trying to retrieve specific information from a bit mask field. Specifically: The termios structure has this member: tcflag_t c_iflag. This member has a constant called IXON which I want to read it to see if it…
0
votes
0 answers

Serial console's terminal defaulting to vt220 when using termios

I'm currently using termios to set up a serial console over USB for a Linux machine. I'm running into a problem however that the serial console's terminal is defaulting to vt220. I would like to use vt100 so I can get color. Once I'm in the serial…
DrinkaZ
  • 79
  • 1
  • 4
0
votes
0 answers

How to create iostream for rs485 I/O in c++

I have a PCI card with a db25 port. This in turn connects to two devices with a de9 port. I need to talk to these devices using rs485. I'm working on a C++11 library that currently creates char arrays for the protocol commands. I would like to put…
Typhaon
  • 828
  • 8
  • 27
0
votes
1 answer

Check if the termios structure was already set

I wrote th following code, to set the terminal to the non-canonical mode: #include #include #include #include #include static struct termios old_terminal = {0}; static bool is_set =…
cj-2307
  • 259
  • 3
  • 14
0
votes
1 answer

false read from serial port

I have problem with reading data from serial port on linux.I configure port using termios library and receive data from microcontroller which work perfectly (I checked that using hterm program) .When i send "e" character to microcontroller it should…
0
votes
1 answer

In linux, CR are unexpectedly converted to LF when ICRNL flag is set and ICANON is unset

According to POSIX General Terminal Interface about carriage return processing: CR Special character on input, which is recognized if the ICANON flag is set; it is the carriage-return character. When ICANON and ICRNL are set and IGNCR is not set,…
freewill
  • 93
  • 4
0
votes
0 answers

UART triggered wrong with termios and sigaction

Hello stack overflow community. It's not easy to explain the problem. Hope you can understand. Setup is a Linux embedded board where I want to communicate over UART. The Board has an imx6ULL. The Linux was builded with Yocto 3.1.5 (dunfell). To…
0
votes
0 answers

understanding tcflush and usleep

I'm working with a serial device RFID reader (caenrfid lepton7). It has a mode where it can send data forever each time it sees a new RFID tag. The problem with the nature of the serial line is that if my program crashes while reading a frame the…
markand
  • 495
  • 1
  • 4
  • 16
0
votes
0 answers

Issues while reading Writting USB data

I am new to Linux operating system, i am trying to interface GSM module with USB,i interfaced USB with GSM module successfully, but i have problem while reading the data from GSM module, i can able to write data to GSM module but while reading its…
MKT
  • 1
  • 2
0
votes
1 answer

Redirect keyboard input echo in linux terminal

So this is a tricky one. After having run matlab in a linux terminal, somehow the echo of keyboard input is lost. That is for example if I type "ls", I don't see "ls" in the terminal but just the output from ls. So somehow I think the echoing of…
Patrick Kwok
  • 42
  • 10
0
votes
1 answer

Read from USB until a special character ; with Ubuntu and Arduino

I have an Arduino code that outputs strings coming from some sensors over the USB. These are the strings: Sensor 1 F1 410nm : 0 F2 435nm : 290 F3 445nm : 0 F4 460nm : 211 F5 480nm : 0 F6 515nm : 0 F7 535nm : 262 F8 555nm : 0 F9 590nm : 0 F10 610nm :…
Marcus Barnet
  • 2,083
  • 6
  • 28
  • 36