4

Let's assume that I run a program which reads/writes to a serial port (/dev/ttyS0). I known that the program uses baud rate 19200 and dynamically sets parity bit (mark parity or space parity).

Is it possible to check those parameters from terminal ?

I have tried setserial -g /dev/ttyS0. Here is output (nothing about parity bit and baud rate):

/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4

2 Answers 2

7

Use stty instead:

stty -F /dev/ttyS0 -a

Example output:

speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 0; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke -flusho -extproc
1
  • rows 0; columns 0; > serial port is dead here
    – Raulp
    Commented Apr 17, 2021 at 15:24
-1

I personally use screen when dealing with serial console

screen /dev/ttyS0 19200
1
  • The question asks not how to set parameters, but rather how to get them.
    – Ruslan
    Commented Apr 21, 2020 at 11:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .