All of lore.kernel.org
 help / color / mirror / Atom feed
* Serial raw mode. Bug in serial driver in Linux kernel? Is documentation correct?
@ 2020-08-12 16:51 Petr Slansky
  2020-08-12 19:09 ` Sergey Organov
  2020-08-12 19:14 ` Sergey Organov
  0 siblings, 2 replies; 3+ messages in thread
From: Petr Slansky @ 2020-08-12 16:51 UTC (permalink / raw)
  To: linux-serial

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... ;-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Serial raw mode. Bug in serial driver in Linux kernel? Is documentation correct?
  2020-08-12 16:51 Serial raw mode. Bug in serial driver in Linux kernel? Is documentation correct? Petr Slansky
@ 2020-08-12 19:09 ` Sergey Organov
  2020-08-12 19:14 ` Sergey Organov
  1 sibling, 0 replies; 3+ messages in thread
From: Sergey Organov @ 2020-08-12 19:09 UTC (permalink / raw)
  To: linux-serial; +Cc: Petr Slansky

Petr Slansky <slansky@gmail.com> writes:

> 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);

You got a bug right here. Just swap these 2 lines. You should first
clear CSIZE bits, then set CS8 size.

-- Sergey Organov


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Serial raw mode. Bug in serial driver in Linux kernel? Is documentation correct?
  2020-08-12 16:51 Serial raw mode. Bug in serial driver in Linux kernel? Is documentation correct? Petr Slansky
  2020-08-12 19:09 ` Sergey Organov
@ 2020-08-12 19:14 ` Sergey Organov
  1 sibling, 0 replies; 3+ messages in thread
From: Sergey Organov @ 2020-08-12 19:14 UTC (permalink / raw)
  To: Petr Slansky; +Cc: linux-serial

Petr Slansky <slansky@gmail.com> writes:

> 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);

You got a bug right here. Just swap these 2 lines. You should first
clear CSIZE bits, then set CS8 size.

-- Sergey Organov

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-12 19:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-12 16:51 Serial raw mode. Bug in serial driver in Linux kernel? Is documentation correct? Petr Slansky
2020-08-12 19:09 ` Sergey Organov
2020-08-12 19:14 ` Sergey Organov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.