2006-12-20 01:24:13 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2006 Michael Brown <mbrown@fensystems.co.uk>.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
|
2009-05-01 16:41:06 +02:00
|
|
|
FILE_LICENCE ( GPL2_OR_LATER );
|
|
|
|
|
2007-07-03 19:20:22 +02:00
|
|
|
#include <stdio.h>
|
2006-12-20 01:24:13 +01:00
|
|
|
#include <console.h>
|
2008-07-24 20:59:12 +02:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <config/general.h>
|
2010-04-19 21:16:01 +02:00
|
|
|
#include <ipxe/keys.h>
|
|
|
|
#include <ipxe/shell_banner.h>
|
2006-12-20 01:24:13 +01:00
|
|
|
|
|
|
|
/** @file
|
|
|
|
*
|
|
|
|
* Shell startup banner
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Print shell banner and prompt for shell entry
|
|
|
|
*
|
|
|
|
* @ret enter_shell User wants to enter shell
|
|
|
|
*/
|
|
|
|
int shell_banner ( void ) {
|
|
|
|
int enter_shell = 0;
|
2008-07-24 21:00:43 +02:00
|
|
|
int wait_count;
|
2008-03-27 00:16:20 +01:00
|
|
|
int key;
|
2006-12-20 01:24:13 +01:00
|
|
|
|
2010-02-04 01:14:35 +01:00
|
|
|
if ( BANNER_TIMEOUT <= 0 ) {
|
|
|
|
return enter_shell;
|
|
|
|
}
|
|
|
|
|
2010-04-19 21:16:01 +02:00
|
|
|
printf ( "\nPress Ctrl-B for the iPXE command line..." );
|
2006-12-20 01:24:13 +01:00
|
|
|
|
|
|
|
/* Wait for key */
|
2008-07-24 21:00:43 +02:00
|
|
|
for ( wait_count = 0 ; wait_count < BANNER_TIMEOUT ; wait_count++ ) {
|
2006-12-20 01:24:13 +01:00
|
|
|
if ( iskey() ) {
|
|
|
|
key = getchar();
|
2008-07-24 21:00:43 +02:00
|
|
|
if ( key == CTRL_B )
|
2006-12-20 01:24:13 +01:00
|
|
|
enter_shell = 1;
|
|
|
|
break;
|
|
|
|
}
|
2008-07-24 20:59:12 +02:00
|
|
|
mdelay(100);
|
2006-12-20 01:24:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Clear the "Press Ctrl-B" line */
|
|
|
|
printf ( "\r \r" );
|
|
|
|
|
|
|
|
return enter_shell;
|
|
|
|
}
|