bugGNU GRUB - Bugs: bug #43604, lack of flow control on serial port


You are not allowed to post comments on this tracker with your current authentication level.

bug #43604: lack of flow control on serial port

Submitted by:  Peter <peetz0r>
Submitted on:  Thu 13 Nov 2014 09:35:59 PM UTC  
Category: TerminalSeverity: Major
Priority: 5 - NormalItem Group: Feature Request
Status: NonePrivacy: Public
Assigned to: Andrei Borzenkov <arvidjaar>Originator Name: 
Open/Closed: OpenRelease: 
Release: otherReproducibility: Every Time
Planned Release: 2.03+

Sat 14 Feb 2015 05:59:04 PM UTC, comment #5:

Sorry for delayed response. I was wrong. The option sets some UART configuration bits, so in any case it is up to used UART to actually implement them. To my knowledge not many do it.

So we are back to lack of proper software implementation of flow control in grub2.

Andrei Borzenkov <arvidjaar>
Project MemberIn charge of this item.
Wed 10 Dec 2014 07:23:59 PM UTC, comment #4:

Ah, grub uses RTS/CTS flow control, but the VT510 uses DTR/DSR.
I though these kind of issues were fixed before I was born (not kidding). Oh well.

More info: http://stackoverflow.com/questions/957337/what-is-the-difference-between-dtr-dsr-and-rts-cts-flow-control

The weird thing is, multiple sources state that linux does not support DTR/DSR, only RST/CTS, yet my VT510 seems completely happy with it... Sending the exact same ascii art from a linux shell just works.

The terminal settings menu is explained here: http://www.vt100.net/docs/vt510-rm/chapter2#S2.9.7
it is set to 'DSR' and 'DTR' (not 'Both', so I know that software flow control is not used).

Peter <peetz0r>
Wed 10 Dec 2014 06:05:37 PM UTC, comment #3:

Actually on x86 hardware flow control should be enabled by default. Did you enable it on terminal?

Andrei Borzenkov <arvidjaar>
Project MemberIn charge of this item.
Wed 10 Dec 2014 12:04:39 AM UTC, comment #2:

So the option does exist after all? But it is not mentioned on http://www.gnu.org/software/grub/manual/grub.html#serial which is wat led me to believe that it didn't.

I will see if it works soon (maybe this week).

This also means that this is not a feature request anymore, but a bug about incomplete documentation.

Peter <peetz0r>
Tue 09 Dec 2014 07:02:44 PM UTC, comment #1:

serial has --rtscts=on|off option to enable hardware flow control but there was an error, so this option did not work. I pushed fix, do you have possibility to test current GIT? Alternatively I attach patch to serial.c that fixes option processing.

(file #32626)

Andrei Borzenkov <arvidjaar>
Project MemberIn charge of this item.
Thu 13 Nov 2014 09:35:59 PM UTC, original submission:

Version: 2.02~beta2-9ubuntu1
OS: Xubuntu 14.04.1 x86 (using their packages)

The serial port in Grub does not support Flow Control (either hardware or software). I have connected a 1997 DEC VT510 serial terminal to a desktop which happened to be old enough to have a serial port. using it from Linux works great. I found out that this terminal really needs flow control, because it displays gibberish when sending enough text fast enough (like scrolling trough man pages) whenever flow control is disabled. Linux (agetty) and the VT510 support flow control, so this issue doesn't really occur there.

Later, I decided that it was boring to look at an empty screen while booting the computer. So I found out that it could display ascii art by using enough echo commands in my grub config. So i edited /etc/grub.d/40_custom and added everything. It seemed to mostly work, but after outputting 1/4th of the logo, a few lines of gibberish would appear instead of the rest of the logo. Not good.

So I rearched for flow control settings. the 'serial' comamnd had options for baud rate, word size, parity, and stop bits. but not flow control. Since there is basically nothing else to check, I concluded that grub2 simply does not support any kind of flow control. Not having flow control is okay when connecting to TTL UART devices like the Raspberry Pi, but not when using actual RS232 like old serial terminals.

When looking for a workaround, I first tried adding 'sleep' commands. Since sleep only works with full seconds, adding sleep every line was too painfully slow. Adding sleep every 8 lines or so worked but showing the ascii art logo in chunks was ugly. Thebn I found out that the play command can also be used as sleep, but it allows smaller durations. I now use 'play 5000 0 1) which sleeps 1/5000th or 12ms after each line. I haven't tested smaller delays, as it is fast enough the way it is now. It sleeps a total of less than 500ms and it works perfectly fine. No gibberish on the terminal and no visible delays or chunks in the output.

Here's a video of the end result with the workaround in place: https://www.youtube.com/watch?v=yMZseIMrvvI

Attached is the relevant bit of my grub config.

But my workaround is mostly an ugly hack and it won't work when the user actually needs real interaction on the terminal.

So the feature request is basically just flow control. Either hardware or software (the VT510 supports both).

Peter <peetz0r>


Attached Files
file #32626:  serial.patch added by arvidjaar (636B - text/x-patch - Patch to fix serial --rtscts option.)
file #32430:  grub-sk1llz-ascii-art-serial-config.txt added by peetz0r (3KiB - text/plain - Attached is the relevant bit of my grub config.)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by phcoder (Updated the item)
  • -unavailable- added by arvidjaar (Updated the item)
  • -unavailable- added by peetz0r (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 02 Mar 2016 10:48:25 AM UTCphcoderPlanned ReleaseNone=>2.03+
    Sat 14 Feb 2015 05:59:04 PM UTCarvidjaarStatusNeed Info=>None
    Tue 09 Dec 2014 07:02:44 PM UTCarvidjaarAttached File-=>Added serial.patch, #32626
      StatusNone=>Need Info
      Assigned toNone=>arvidjaar
    Thu 13 Nov 2014 09:35:59 PM UTCpeetz0rAttached File-=>Added grub-sk1llz-ascii-art-serial-config.txt, #32430

    Back to the top

    Powered by Savane 3.1-cleanup1