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

One line serial communication, echos wrong

I have a one line serial communication interface, and the problem is that I send in 01010101 and the echo that I receive is 8 out of 10 times 01010101 but 2 out of 10 I receive 01110101. Code example: void checkVersion(int fd) { tcflush(fd,…
NeViXa
  • 73
  • 7
-1
votes
1 answer

rs232 read() return 0 on YOCTO

I've two application software running (sender and receiver) on 2 different booard comunicating beetween then via rs232 links The rs232 port on boths side has been configuarte in same way and sender side I've 2 second sleep between 2 trasmission. The…
H2O
  • 153
  • 1
  • 1
  • 13
-1
votes
1 answer

resizable box-drawing in the terminal

I'm currently trying to do pretty cli apps, my goal is to make a box that makes the whole outline of the terminal. What I currently do: Grab the size of the terminal Draw the top line : top-left corner + (width - 2) * top edge + top-right…
-1
votes
1 answer

How to supress display of \n after input in c++?

I have written a simple FORTH-like interpreter where I get input a line at a time and process it like this: std::string line; while (!std::cin.eof()) { std::getline(std::cin, line); std::istringstream input(line); …
Jaldhar
  • 279
  • 1
  • 10
-1
votes
1 answer

Is sleep must after tcdrain()?

I am testing my serial port library's write function.At first, I arranged serial port file descriptor as nonblocking file descriptor. Then I call tcdrain(fd) at the end of the my customized write function. But If I don't wait with sleep() after this…
user3104363
  • 182
  • 1
  • 14
-1
votes
1 answer

Programming pseudo terminals communication by termios. Parity bit option doesn't works

I need to make a chat using serial ports. I emulate pty by socat: socat -d -d PTY PTY Next I wrote small demo. That's how I initialize termios structure: int tty_fd = open(argv[1], O_RDWR | O_NONBLOCK); struct termios tio; …
-2
votes
1 answer

c++, termios, non canonical, blocking, detect end of message

I wrote a blocking loop to read unsolicited messages. I can't have an end char to detect the end of the message, but I am pretty happy with the timeout. VMIN=1 VTIME=5 Here when the recieved bytes are fewer than the buffer size, I presume the end of…
Jackt
  • 171
  • 1
  • 1
  • 15
-2
votes
1 answer

linux echo and it's means

the status of the echo bit in the driver for file descriptor 0. Use redirection operator < to attach standard input to other files of devices. Try these experiments: $ ./echostate < /dev/pts/0 $ ./echostate < /etc/passwd Output plz explain to me…
-5
votes
0 answers

How to set vtime and vmin for streaming serial data

I am looking for reference and pointers on setting vmin and vtimer for recieving streaming serial application. MEssages of varying length are send to the application in at random timing but at a fixed frequency for each message( some messages could…
user1538798
  • 1,075
  • 3
  • 17
  • 42
1 2 3
20
21