How to configure a serial port?

I use Linux as a programming platform. And I want to create a program that uses the serial port (/ dev / ttyS0) as the communication medium. I already know how to open, read, write and close the serial port using the standard Linux function.

Now my question is: how can I configure the serial port? I want to say that I want to programmatically change the parameters of a serial device.

Many thanks.

+3
source share
3 answers

The human page you should read is termios (3). It describes the POSIX functions for controlling the discipline of the TTY line in which the serial parameters reside.

+2

tcgetattr() tcsetattr(), , ..

I/O . . select() poll().

+1

This link: http://www.easysw.com/~mike/serial/serial.html You will find a bunch of useful information.

0
source

Source: https://habr.com/ru/post/1748501/


All Articles