Serial raw mode. Bug in serial driver in Linux kernel? Is documentation correct?
From: Petr Slansky <hidden>
Date: 2020-08-12 16:51:53
Hi Linux-Serial,
I was fixing "pirate-loader" for BusPirate device, firmware loader utility.
The design followed documentation for serial communication for "row"
serial mode but it was not working. I modified flags and utility works
now but my modification doesn't match documentation. That is strange
from my point of view. Have I discovered a bug in the kernel? Could
you check??
Details are here, second comment, the long one:
https://github.com/BusPirate/Bus_Pirate/issues/140
This is the core of my fix, I changed CSIZE flag:
cfmakeraw(&g_new_tio);
- g_new_tio.c_cflag |= (CS8 | CLOCAL | CREAD);
- g_new_tio.c_cflag &= ~(PARENB | CSTOPB | CSIZE);
- g_new_tio.c_oflag = 0;
- g_new_tio.c_lflag = 0;
+ g_new_tio.c_cflag |= (CS8 | CSIZE | CLOCAL | CREAD);
+ g_new_tio.c_cflag &= ~(PARENB | CSTOPB);
+ //g_new_tio.c_oflag = 0;
+ //g_new_tio.c_lflag = 0;
When I write about wrong documentation, that information is on many
places including "man cfmakeraw":
termios_p->c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP |
INLCR | IGNCR | ICRNL | IXON);
termios_p->c_oflag &= ~OPOST;
termios_p->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
termios_p->c_cflag &= ~(CSIZE | PARENB);
termios_p->c_cflag |= CS8;
With regards,
Petr
BTW, I tried to send this email to Greg KH first but he asked me to
send my email to this group because his INBOX is full of unread
messages (912 messages in /home/greg/mail/INBOX/). That is not so bad,
I have more than 5000 unread messages in my INBOX... ;-)