From 229c1272d15be52423ec2f6914d5664313501cac Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Mon, 31 May 2010 23:59:46 +0200 Subject: [PATCH 1/1] console/serial bootoption: allow manually specifying speed settings. --- autoconfig.functions | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/autoconfig.functions b/autoconfig.functions index c0c1111..f55b0d3 100755 --- a/autoconfig.functions +++ b/autoconfig.functions @@ -575,8 +575,33 @@ fi # activate serial console {{{ config_console(){ if checkbootparam 'console'; then - einfo "Bootoption for serial console detected, activating console login." - sed -i 's/^#grmlserial#//' /etc/inittab + einfo "Bootoption for serial console detected:" + + local serial="$(getbootparam console=ttyS)" + option="${serial##*,}" + + # default to: + local speed="115200,57600,38400,19200,9600,4800,2400,1200"; + # ... unless overriden by command line: + case "$option" in + 115200*) speed=115200 ;; + 57600*) speed=57600 ;; + 38400*) speed=38400 ;; + 19200*) speed=19200 ;; + 9600*) speed=9600 ;; + 4800*) speed=4800 ;; + 2400*) speed=2400 ;; + 1200*) speed=1200 ;; + esac + + eindent + einfo "Setting baud rate to ${speed}." + sed -i "s/%serialspeed%/$speed/" /etc/inittab ; eend $? + + einfo "Activating console login." + sed -i 's/^#grmlserial#//' /etc/inittab ; eend $? + eoutdent + /sbin/telinit q eend $? fi -- 2.1.4