hey, I'm working on enabling a platform that I'm told will be using hardware flow control on the serial console. To prepare for this, I've put together this patch to detect the crtscts setting on the console, and set the -h flag for the getty. It works, but I'd appreciate a review by someone who knows serial more than I. Specifically, is it possible that a system that uses crtscts would not behave well w/ 'getty -h'?
diff --git a/finish-install.d/90console b/finish-install.d/90console index 272e0a1..2ec91cc 100755 --- a/finish-install.d/90console +++ b/finish-install.d/90console @@ -17,6 +17,13 @@ write_console() { fi } +uses_hw_flowcontrol() { + local dev="$1" + + chroot /target stty -a --file /dev/$dev | tr ' ' '\n' | \ + grep -q '^crtscts$' +} + KEEP_VT= if db_get finish-install/keep-consoles && [ "$RET" = true ]; then KEEP_VT=1 @@ -61,6 +68,11 @@ case "$console" in ttyspeed=$(chroot /target stty --file /dev/$console speed) ttyterm="$TERM" + flowctrlarg="" + if uses_hw_flowcontrol $console; then + flowctrlarg="-h " + fi + if [ -z "$ttyterm" ]; then ttyterm=vt100; fi if [ -z "$ttyspeed" ]; then ttyspeed=9600; fi @@ -73,12 +85,14 @@ case "$console" in sed -i -e "s/^#T0\(.*\)ttyS.*/T$ttyline\1$console $ttyspeed $ttyterm/" \ /target/etc/inittab sed -i -e "s/^\(T$ttyline.*\) -8/\1/" /target/etc/inittab + sed -i -e "s/^\(T$ttyline.* \)-L/\1$flowctrlarg-L/" /target/etc/inittab fi if [ "$upstart_tty1" ]; then sed -e "s/^\(exec.*getty \).*/\1-L $console $ttyspeed $ttyterm/" \ -e "s/tty1/$console/g" \ "$upstart_tty1" > "$(upstart_console "$console")" sed -i -e "s/^\(exec.*\) -8/\1/" "$(upstart_console "$console")" + sed -i -e "s/^\(exec.*\)-L/\1$flowctrlarg-L/" "$(upstart_console "$console")" fi write_console "$rawconsole" /target/etc/securetty -- To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20140513005604.GA7874@fluid.dannf