Browse Source

[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.
tags/v0.9.4
Andrew Schran 16 years ago
parent
commit
833447392d
2 changed files with 8 additions and 5 deletions
  1. 2
    0
      src/config.h
  2. 6
    5
      src/hci/shell_banner.c

+ 2
- 0
src/config.h View File

58
  */
58
  */
59
 #define TIMER_BIOS		/* 18Hz BIOS timer */
59
 #define TIMER_BIOS		/* 18Hz BIOS timer */
60
 #define TIMER_RDTSC		/* CPU TimeStamp Counter timer */
60
 #define TIMER_RDTSC		/* CPU TimeStamp Counter timer */
61
+#define BANNER_TIMEOUT	20	/* Tenths of a second for which the shell
62
+				   banner should appear */
61
 
63
 
62
 /* @END general.h */
64
 /* @END general.h */
63
 
65
 

+ 6
- 5
src/hci/shell_banner.c View File

18
 
18
 
19
 #include <stdio.h>
19
 #include <stdio.h>
20
 #include <console.h>
20
 #include <console.h>
21
-#include <gpxe/timer.h>
21
+#include <unistd.h>
22
+#include <config/general.h>
22
 #include <gpxe/shell_banner.h>
23
 #include <gpxe/shell_banner.h>
23
 
24
 
24
 /** @file
25
 /** @file
27
  *
28
  *
28
  */
29
  */
29
 
30
 
30
-#define BANNER_TIMEOUT ( 2 * TICKS_PER_SEC )
31
-
32
 /**
31
 /**
33
  * Print shell banner and prompt for shell entry
32
  * Print shell banner and prompt for shell entry
34
  *
33
  *
35
  * @ret	enter_shell		User wants to enter shell
34
  * @ret	enter_shell		User wants to enter shell
36
  */
35
  */
37
 int shell_banner ( void ) {
36
 int shell_banner ( void ) {
38
-	unsigned long timeout = ( currticks() + BANNER_TIMEOUT );
37
+	int wait_count = 0;
39
 	int enter_shell = 0;
38
 	int enter_shell = 0;
40
 	int key;
39
 	int key;
41
 
40
 
42
 	printf ( "\nPress Ctrl-B for the gPXE command line..." );
41
 	printf ( "\nPress Ctrl-B for the gPXE command line..." );
43
 
42
 
44
 	/* Wait for key */
43
 	/* Wait for key */
45
-	while ( currticks() < timeout ) {
44
+	while ( wait_count < BANNER_TIMEOUT ) {
46
 		if ( iskey() ) {
45
 		if ( iskey() ) {
47
 			key = getchar();
46
 			key = getchar();
48
 			if ( key == 0x02 /* Ctrl-B */ )
47
 			if ( key == 0x02 /* Ctrl-B */ )
49
 				enter_shell = 1;
48
 				enter_shell = 1;
50
 			break;
49
 			break;
51
 		}
50
 		}
51
+		mdelay(100);
52
+		wait_count++;
52
 	}
53
 	}
53
 
54
 
54
 	/* Clear the "Press Ctrl-B" line */
55
 	/* Clear the "Press Ctrl-B" line */

Loading…
Cancel
Save