[syslinux] PROMPT=0/ESCAPE key SERIAL fun

Sergey Vlasov vsu at altlinux.ru
Mon Aug 17 04:32:38 PDT 2009


> alex at berk:/usr/src$ diff -u syslinux-3.82/core/ui.inc.orig 
> syslinux-3.82/core/ui.inc
> --- syslinux-3.82/core/ui.inc.orig      2009-08-07 17:53:57.419472369 +0100
> +++ syslinux-3.82/core/ui.inc   2009-08-07 20:31:19.868015273 +0100
> @@ -48,6 +48,16 @@
>  ;
>  ; Check whether or not we are supposed to display the boot prompt.
>  ;
> +check_for_key_serial:
> +               mov dx,[SerialPort]             ; No serial port -> no input
> +               and dx,dx
> +               jz check_for_key
> +;              call pollchar
> +;              jz check_for_key
> +               call reset_idle
> +               call getchar
> +               cmp al,1Bh                      ; <ESC>
> +               je enter_command
>  check_for_key:
>                 test byte [KbdFlags],5Bh        ; Shift Alt Caps Scroll
>                 jnz enter_command
> ----
> 
> Now, if I hold the escape[1] key down on boot from the serial port it 
> works great.  The problem is that if I don't press a key the boot 
> process blocks until it gets a keypress.  Annoyingly 'pollchar' seems to 
> do nothing useful here (just returns stating no key has been pressed) 
> and the only way I can get it to function is to force calling 'getchar'.

You need to add some delay here - otherwise there is no chance to get
even a single byte from the serial port after it was just initialized.
E.g., add a loop like in getchar_timeout (note that the repeat count
must be at least 2, because the time to wait for the first tick might
be very short, depending on the timer phase when the loop is entered).

You may also create a small com32 module to do this instead of
changing the syslinux core directly (load your module in DEFAULT, and
invoke syslinux_run_command() with the appropriate label from your
module to continue boot).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://www.zytor.com/pipermail/syslinux/attachments/20090817/a89ffbaa/attachment.sig>


More information about the Syslinux mailing list