]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[cmdline] Added configurable shell banner timeout
authorAndrew Schran <aschran@google.com>
Thu, 24 Jul 2008 18:59:12 +0000 (19:59 +0100)
committerMichael Brown <mcb30@etherboot.org>
Thu, 24 Jul 2008 18:59:12 +0000 (19:59 +0100)
This change allows the time for which shell banners are displayed to
be configured in the config.h file.  The ability to access the shell
can also be effectively disabled by setting this timeout to zero.

src/config.h
src/hci/shell_banner.c

index f43da04045e9b63ebaed274596f17cedec4c3710..13d9f7e02963123d28bb60271d3c8c0e4eedf6ef 100644 (file)
@@ -58,6 +58,8 @@
  */
 #define TIMER_BIOS             /* 18Hz BIOS timer */
 #define TIMER_RDTSC            /* CPU TimeStamp Counter timer */
+#define BANNER_TIMEOUT 20      /* Tenths of a second for which the shell
+                                  banner should appear */
 
 /* @END general.h */
 
index 92cd17ddfccef6b81560dbcee68bd37b93285bc5..f96f2a5042ac2815ee834ce60f36127d5afa64e9 100644 (file)
@@ -18,7 +18,8 @@
 
 #include <stdio.h>
 #include <console.h>
-#include <gpxe/timer.h>
+#include <unistd.h>
+#include <config/general.h>
 #include <gpxe/shell_banner.h>
 
 /** @file
  *
  */
 
-#define BANNER_TIMEOUT ( 2 * TICKS_PER_SEC )
-
 /**
  * Print shell banner and prompt for shell entry
  *
  * @ret        enter_shell             User wants to enter shell
  */
 int shell_banner ( void ) {
-       unsigned long timeout = ( currticks() + BANNER_TIMEOUT );
+       int wait_count = 0;
        int enter_shell = 0;
        int key;
 
        printf ( "\nPress Ctrl-B for the gPXE command line..." );
 
        /* Wait for key */
-       while ( currticks() < timeout ) {
+       while ( wait_count < BANNER_TIMEOUT ) {
                if ( iskey() ) {
                        key = getchar();
                        if ( key == 0x02 /* Ctrl-B */ )
                                enter_shell = 1;
                        break;
                }
+               mdelay(100);
+               wait_count++;
        }
 
        /* Clear the "Press Ctrl-B" line */