mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-20 22:48:22 +00:00
add --enable-serial-speed-simulation into configure, fix a bug in setjmp/longjmp, add --speed into the command serial, restart the command-line interface when a serial terminal is enabled.
This commit is contained in:
1 parent
2455b65f2e
commit
d91146efac
9 files changed
+234
-105
No files matched your search
+20
-10
@@ -2672,6 +2672,16 @@ serial_func (char *arg, int flags)
|
||||
|
||||
port = serial_get_port (unit);
|
||||
}
|
||||
else if (grub_memcmp (arg, "--speed=", sizeof ("--speed=") - 1) == 0)
|
||||
{
|
||||
char *p = arg + sizeof ("--speed=") - 1;
|
||||
int num;
|
||||
|
||||
if (! safe_parse_maxint (&p, &num))
|
||||
return 1;
|
||||
|
||||
port = (unsigned int) num;
|
||||
}
|
||||
else if (grub_memcmp (arg, "--port=", sizeof ("--port=") - 1) == 0)
|
||||
{
|
||||
char *p = arg + sizeof ("--port=") - 1;
|
||||
@@ -2776,13 +2786,14 @@ static struct builtin builtin_serial =
|
||||
"serial",
|
||||
serial_func,
|
||||
BUILTIN_MENU | BUILTIN_CMDLINE,
|
||||
"serial [--unit=UNIT] [--port=PORT] [--word=WORD] [--parity=PARITY] [--stop=STOP] [--device=DEV]",
|
||||
"serial [--unit=UNIT] [--port=PORT] [--speed=SPEED] [--word=WORD] [--parity=PARITY] [--stop=STOP] [--device=DEV]",
|
||||
"Initialize a serial device. UNIT is a digit that specifies which serial"
|
||||
" device is used (e.g. 0 == COM1). If you need to specify the port number,"
|
||||
" set it by --port. WORD is the word length, PARITY is the type of parity,"
|
||||
" which is one of `no', `odd' and `even'. STOP is the length of stop bit(s)."
|
||||
" The option --device can be used only in the grub shell, which specifies"
|
||||
" the file name of a tty device. The default values are COM1, 8N1."
|
||||
" set it by --port. SPEED is the DTE-DTE speed. WORD is the word length,"
|
||||
" PARITY is the type of parity, which is one of `no', `odd' and `even'."
|
||||
" STOP is the length of stop bit(s). The option --device can be used only"
|
||||
" in the grub shell, which specifies the file name of a tty device. The"
|
||||
" default values are COM1, 9600, 8N1."
|
||||
};
|
||||
|
||||
|
||||
@@ -3319,12 +3330,11 @@ terminal_func (char *arg, int flags)
|
||||
{
|
||||
terminal = TERMINAL_SERIAL;
|
||||
(void) getkey ();
|
||||
|
||||
/* If the interface is currently the command-line, restart
|
||||
it to repaint the screen. */
|
||||
if (flags & BUILTIN_CMDLINE)
|
||||
{
|
||||
/* FIXME: It is better to restart enter_cmdline except
|
||||
for init_cmdline. */
|
||||
init_page ();
|
||||
}
|
||||
grub_longjmp (restart_cmdline_env, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -25,6 +25,8 @@
|
||||
# include <etherboot.h>
|
||||
#endif
|
||||
|
||||
grub_jmp_buf restart_cmdline_env;
|
||||
|
||||
/* Find the next word from CMDLINE and return the pointer. If
|
||||
AFTER_EQUAL is non-zero, assume that the character `=' is treated as
|
||||
a space. Caution: this assumption is for backward compatibility. */
|
||||
@@ -120,6 +122,7 @@ enter_cmdline (char *heap, int forever)
|
||||
{
|
||||
/* Initialize the data and print a message. */
|
||||
init_cmdline ();
|
||||
grub_setjmp (restart_cmdline_env);
|
||||
init_page ();
|
||||
#ifdef SUPPORT_DISKLESS
|
||||
print_network_configuration ();
|
||||
@@ -231,6 +234,6 @@ run_script (char *script, char *heap)
|
||||
|
||||
/* Run BUILTIN->FUNC. */
|
||||
arg = skip_to (1, heap);
|
||||
(builtin->func) (arg, BUILTIN_CMDLINE);
|
||||
(builtin->func) (arg, BUILTIN_SCRIPT);
|
||||
}
|
||||
}
|
||||
@@ -699,6 +699,7 @@ void stop_floppy (void);
|
||||
#define BUILTIN_CMDLINE 0x1 /* Run in the command-line. */
|
||||
#define BUILTIN_MENU 0x2 /* Run in the menu. */
|
||||
#define BUILTIN_TITLE 0x4 /* Only for the command title. */
|
||||
#define BUILTIN_SCRIPT 0x8 /* Run in the script. */
|
||||
|
||||
/* The table for a builtin. */
|
||||
struct builtin
|
||||
@@ -773,11 +774,18 @@ typedef unsigned long grub_jmp_buf[6];
|
||||
# define grub_jmp_buf jmp_buf
|
||||
#endif
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
# define grub_setjmp setjmp
|
||||
# define grub_longjmp longjmp
|
||||
#else /* ! GRUB_UTIL */
|
||||
int grub_setjmp (grub_jmp_buf env);
|
||||
void grub_longjmp (grub_jmp_buf env, int val);
|
||||
#endif /* ! GRUB_UTIL */
|
||||
|
||||
/* The environment for restarting Stage 2. */
|
||||
extern grub_jmp_buf restart_env;
|
||||
/* The environment for restarting the command-line interface. */
|
||||
extern grub_jmp_buf restart_cmdline_env;
|
||||
|
||||
/* misc */
|
||||
void init_page (void);
|
||||
|
||||
Reference in new issue
Block a user