-
Notifications
You must be signed in to change notification settings - Fork 403
Use the baud rate given on the cmdline for getty #701
Conversation
Don't just default to 9600 Baud on serial consoles when given one with options on the Linux kernel commandline. Should work with the format given on https://www.kernel.org/doc/html/latest/admin-guide/serial-console.html
IFS=, read TTY BAUDRATE _ <<<"${CONSOLE_SPEC}" | ||
|
||
if [ -n "$BAUDRATE" ]; then | ||
BAUDRATE=$(grep -o '^[0-9]*' <<< "$BAUDRATE") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this restricting BAUDRATE to be only numbers? If so, I think this should support stuff like 9600n8
(like described in the kernel page you've linked).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for only matching the numbers is that getty only expects numbers as the parameter where $BAUDRATE
is used. As far as I can tell from the manual, getty is able to infer stop bits, checksum etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFICT the serial port has no auto-negotiation feature, so I'm now wondering how it does that magic!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, getty only has a flag for "assume 8bit clean", it doesn't have a flag for 7bit with odd, even, none or space parity, so maybe it guesses and things just work. Anyway, the patch still makes things better, even if it assumes 8bit. In my case I was using a machine with coreboot hard-coded to 115200 baud, meaning I had to start my term with that baud rate, and switch to 9600 when the kernel started to see a complete boot log.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed it does, no doubt about that :-)
Coreboot? Woah! What machine do you have? I've very curious who is using coreboot :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an https://pcengines.ch/apu2c4.htm, it's a very nice machine I can only recommend them :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I've been looking at the apu4d4 model, but I still can't justify getting one eheh
Don't just default to 9600 Baud on serial consoles when given one with options on the Linux kernel command line.
Should work with the format given onhttps://www.kernel.org/doc/html/latest/admin-guide/serial-console.html