Kaynağa Gözat

[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 yıl önce
ebeveyn
işleme
833447392d
2 değiştirilmiş dosya ile 8 ekleme ve 5 silme
  1. 2
    0
      src/config.h
  2. 6
    5
      src/hci/shell_banner.c

+ 2
- 0
src/config.h Dosyayı Görüntüle

@@ -58,6 +58,8 @@
58 58
  */
59 59
 #define TIMER_BIOS		/* 18Hz BIOS timer */
60 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 64
 /* @END general.h */
63 65
 

+ 6
- 5
src/hci/shell_banner.c Dosyayı Görüntüle

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

Loading…
İptal
Kaydet