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
0 answers

Find Serial Buffer Size of Converter

I'm using an FTDI USB-to-Serial converter on linux. I'm writing an application that implements the standard functionality of changing settings like baud rate, etc... The only thing that I'm not sure how to get is the buffer size, e.g. if the user…
Gatica
  • 593
  • 1
  • 6
  • 13
1
vote
2 answers

Linux termios VTIME not working?

We've been bashing our heads off of this one all morning. We've got some serial lines setup between an embedded linux device and an Ubuntu box. Our reads are getting screwed up because our code usually returns two (sometimes more, sometimes exactly…
San Jacinto
  • 8,774
  • 5
  • 43
  • 58
1
vote
1 answer

Can't write to GSM module through Serial connection from ARM board

In our Graduation project, we're supposed to connect a GSM module (ADH8066) to our ARM board (OK-6410) which is running Embedded Linux (Qtopia) and communicate with it. When we first operate on the module, it sends a "Ready" message, then we can…
ElOrabi
  • 11
  • 2
1
vote
0 answers

how handle ctrl-z within custom command-line interface?

I'm trying to make a command-line interface. I want it to handle Ctrl+Z. It handles Ctrl+C just fine. For now, I have to hit Ctrl+Z twice, before it processes the Ctrl+Z. Here's the code that handles Ctrl+Z: } else if (c == 26) { //…
Ben
  • 61
  • 2
  • 4
1
vote
1 answer

Read timeout on pty file descriptor failing

I am trying to set a read timeout on a file descriptor representing a PTY. I have set VMIN = 0 and VTIME = 10 in termios, which I expect to return when a character is available, or after a second if no characters are available. However, my program…
FazJaxton
  • 7,544
  • 6
  • 26
  • 32
0
votes
2 answers

ttys0 misses/garbles data while ttyusb0 does not

A program in c using termios works well if the port is ttyusb0, but misses/garbles data if got through ttys0 i.e comport com1. proogram runs under ubuntu 9.04 & 10.04 Please suggest the remedies cause for this discrepancy.
0
votes
0 answers

Serial device skipping every other message (linux termios)

I'm trying to write some bytes to a serial port: #include #include #include #include #include #include #include int main() { // Open serial port port_fd =…
ewaddicor
  • 29
  • 2
0
votes
0 answers

Unable to import termios package in windows 10

I am trying to run project in python import termios ModuleNotFoundError: No module named 'termios' I tried to install it but could not. I read that termios does not work in windows 10 But I have to run the code in windows 10 Any…
Sky2000
  • 1
  • 3
0
votes
1 answer

Debuging failed JNA call to termios function tcgetattr()

I am trying to debug my call to termios function tcgetattr(). It returns -1 as the result and I searched internet to find out more details about what the call fails. I found that I can make a call to explain_tcgetattr() to get more details about the…
Shivam...
  • 409
  • 1
  • 8
  • 21
0
votes
0 answers

Why settings for termios doesn't reset each time I run my program?

I'm trying to make a program which will listen to a serial port (gps antena) for logs sent by it every second. The program works as expected, but when I start listening with pygpsclient the termios settings are modified so I set them in my…
MBI
  • 15
  • 4
0
votes
1 answer

Serial communication with a modem, tcdrain/tcflush

I am trying to create a reliable serial communication with a UHF modem. Here is the steps I do: To send a command to the modem: 1. tcflush(fd, TCIOFLUSH) 2. readEmpty(fd) -> custom function that reads from fd in a while loop until no characters…
NickG
  • 111
  • 4
0
votes
0 answers

Linux tcgetattr followed by tcsetattr not working

I need to save the terminal attributes (tcgetattr), set them to something that will block terminal echoing etc. (calling tcsetattr), and then later, after doing things with the framebuffer device /dev/fb0, restore the original attributes (calling…
s_question
  • 21
  • 2
0
votes
1 answer

UART loss special data during transmission

I am coding a uart application in Linux written in C, in my case, Linux need to send bytes stream to device which is connnected with UART (UART is in hardware flow control with DTSCTS, baudrate is 115200, no parity, no odd/even bits). The question…
Rui
  • 97
  • 1
  • 8
0
votes
1 answer

How to Pass a Character Array to a Function Expecting a void* Pointer?

I'm using the termios.h and unistd.h library to read from a serial port via the read(2) function ssize_t read(int fd, void *buf, size_t count); The following code works just fine calling the read function: char read_buf [256]; int n =…
GHall
  • 3
  • 1
0
votes
0 answers

Increasing VMIN (Serial Port) in Linux C++

Like the question suggests, I would like to know if there is a way to increase my VMIN with serial programming. I am using a USB device that opens a Virtual Serial Port as an endpoint in Linux. The device will send a variable size message between…
MamaShark
  • 19
  • 2