Hi, For some time now I have been using pxelinux to add a helpful 'administrator' boot mode to our workstations with the following 'pxelinux.cfg/default' config: ---- DEFAULT local PROMPT 0 TIMEOUT 0 TOTALTIMEOUT 1 ONTIMEOUT menu ALLOWOPTIONS 0 NOESCAPE 0 LABEL local LOCALBOOT 0 LABEL menu CONFIG /pxelinux.cfg/default-menu ---- This is great as by default it goes straight to a local harddisk boot however if you hold down one of the escape (modifier) keys on boot then it drops you into a console menu. As my heart lives in ARM/MIPS/SPARC I felt it was about time to add serial support to our PXE booting fun and so slipped in the SERIAL line at the top. It works (as in I see all the serial output) but of course the serial console has no concept of modifier keys and so I cannot escape off into the 'default-menu'. No problem I thought, I'll patch some sourcecode: ---- 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'. Any ideas how to fix this, this would be *really* handy :) Cheers [1] I felt escape was appropriate as it is completely inappropriate when sent from the keyboard. The downside is you get a looping in the reloading of the 'default-menu' until you stop holding it down (maybe backspace, 08h, is more suitable?) but as the admin menu is rarely called upon and the issue is just cosmetic I'm not really bothered -- Alexander Clouter .sigmonster says: What soon grows old? Gratitude. -- Aristotle
Hi, No love from anyone eh? :-/ Regards * Alexander Clouter <alex at digriz.org.uk> [2009-08-10 11:06:55+0100]:> > For some time now I have been using pxelinux to add a helpful > 'administrator' boot mode to our workstations with the following > 'pxelinux.cfg/default' config: > ---- > DEFAULT local > > PROMPT 0 > > TIMEOUT 0 > TOTALTIMEOUT 1 > ONTIMEOUT menu > > ALLOWOPTIONS 0 > NOESCAPE 0 > > LABEL local > LOCALBOOT 0 > > LABEL menu > CONFIG /pxelinux.cfg/default-menu > ---- > > This is great as by default it goes straight to a local harddisk boot > however if you hold down one of the escape (modifier) keys on boot then > it drops you into a console menu. > > As my heart lives in ARM/MIPS/SPARC I felt it was about time to add > serial support to our PXE booting fun and so slipped in the SERIAL line > at the top. It works (as in I see all the serial output) but of course > the serial console has no concept of modifier keys and so I cannot > escape off into the 'default-menu'. > > No problem I thought, I'll patch some sourcecode: > ---- > 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'. > > Any ideas how to fix this, this would be *really* handy :) > > Cheers > > [1] I felt escape was appropriate as it is completely inappropriate when > sent from the keyboard. The downside is you get a looping in > the reloading of the 'default-menu' until you stop holding it > down (maybe backspace, 08h, is more suitable?) but as the admin > menu is rarely called upon and the issue is just cosmetic I'm > not really bothered-- Alexander Clouter .sigmonster says: Hummingbirds never remember the words to songs.
> 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>