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

How to change the echo character in a linux terminal

I am interested in gathering a password from a user. When the user is prompted for their password, I want to echo back to them * (asterisks) for each character they input. void changeEcho() { termios term; tcgetattr(STDIN_FILENO, &term); …
Nick
  • 25
  • 8
1
vote
0 answers

send/receive string via GATT in BLE

I have been successfully sending and receiving hexa values via GATT using "Heart rate service" and with characteristic "Heart Rate Measurement". Now I need to send TX/RX strings over GATT. Can anyone help me out by giving suggestion about: Which…
Loki
  • 11
  • 1
1
vote
1 answer

How to make C program communicate with Python program using Linux's virtual serial ports?

I would like to send data from a C program into a Python program that will visualize this data. Development environment is a Linux (Ubuntu 18.04LTS) computer. To be clearer, both of the programs are running on the same computer. I am using termios…
odd
  • 131
  • 1
  • 3
  • 9
1
vote
1 answer

Linux termios noncanonical read() timeout doesn't work

I'm currently trying to communicate with an external device using the serial port, and it works just fine... if the device is connected. However, since there is no guarantee that it is (and i have multiple serial ports to choose from), it would be…
Felix G
  • 674
  • 1
  • 7
  • 17
1
vote
1 answer

C++ Serial communication reading data works but writing fails

I'm creating a class for Serial communication between an embedded system and a C++ application running in a Linux environment. Therefore I used the termios API for Linux, which is described here. The constructor will open the device's serial port.…
Dirk
  • 95
  • 1
  • 8
1
vote
1 answer

Can't read from serial port if not opened once with minicom

I have implemented a blocking read from serial port in C. My aim is to have a read which blocks until new data arrives. Here is how I have implemented the serial pseudo-object (I've removed multithread protections for the code to be…
Arkaik
  • 852
  • 2
  • 19
  • 39
1
vote
1 answer

serial data truncated by termios on embedded device

I am working on a C program listening to the serial port running on an ARM Linux embedded device. Other sets of data work fine, but always when I send a particular set of data, the beginning of the set is truncated. What is truncated is the…
quadmore
  • 69
  • 1
  • 3
1
vote
1 answer

Python3.4 termios modification

I am trying to figure out how to use the termios calls to configure the tty. Below I am playing with baudrate. I am able to call tcgetattr, change the values, see that they have changed in a print before I send them. However tcsetattr followed by…
DougM
  • 9
  • 2
1
vote
1 answer

Termios.h error on linux, -lftdi error on windows. cross compiling

I am able to compile this for linux and run it on linux, but I would like to be able to run it on my windows machine as well. https://github.com/bear24rw/rgb_table/tree/master/code/table_drivers/beat_finder (is this allowed?) When I try to cross…
1
vote
1 answer

How to map termios bytes to struct?

I want to map the termios bytes returned by the Libc function tcgetattr to a class in C#. In C termios is defined as: #define NCCS 12 typedef unsigned cc_t; typedef unsigned speed_t; typedef unsigned tcflag_t; struct termios { cc_t …
OlavT
  • 2,496
  • 4
  • 31
  • 56
1
vote
0 answers

How do I upgrade a shell into TTY in C?

I'm developing a client that uses TCP sockets to connect to a listening server (an ncat for example) and when it does the program uses the dup2(socketfd, all three standard I/O file descriptors) syscall to send a shell to the server when It connects…
Brian Fiszman
  • 148
  • 1
  • 11
1
vote
1 answer

Difference between USB Serial in Windows and Linux

I bought a Variense VMU931 inertial measurement unit (IMU) for a robotics project at school, and I am struggling to get it to reliably communicate with my laptop in Ubuntu. I am using C++ with termios to connect to it using 8n1 no parity blah blah…
J. Ford
  • 15
  • 3
1
vote
1 answer

How to register an event using termios.h in a class

I'm making a c++ serial class in Linux. I'm trying to register an event when incoming data is received. I'm working on a Olimex Lime2 board. gcc version 4.6.3 (Debian 4.6.3-14) This is the error i get when trying to compile. conSerial.cpp: In…
1
vote
1 answer

Linux serial read blocks minicom

I'm attempting to read from a serial port (/dev/ttyS4) on a BeagleBone Black, but I think(?) this should apply to all Linux devices in general. Currently, I can set up minicom with a baud rate of 9600 and 8N1 data to read from the serial port…
Ernest3.14
  • 1,012
  • 11
  • 21
1
vote
3 answers

How to change termios configuration, so that getc() immediately returns when user presses key?

I want to implement auto-completion feature for my CLI application. The default behavior of getc() is returning only when the following list of characters are entered: NEW_LINE or EOF. I want to add TAB to this list so that I can trigger my…
Benji Mizrahi
  • 2,154
  • 2
  • 23
  • 38