Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[cmdline] Added configurable shell banner timeout
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.
  • Loading branch information
Andrew Schran authored and Michael Brown committed Jul 24, 2008
1 parent 6b58992 commit 8334473
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/config.h
Expand Up @@ -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 */

Expand Down
11 changes: 6 additions & 5 deletions src/hci/shell_banner.c
Expand Up @@ -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
Expand All @@ -27,28 +28,28 @@
*
*/

#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 */
Expand Down

0 comments on commit 8334473

Please sign in to comment.