* grub-core/term/serial.c (options), (grub_cmd_serial): Fix handling

of SI suffixes.
This commit is contained in:
Vladimir Serbinenko 2013-11-01 19:46:30 +01:00
parent 89295a0628
commit 896f913571
2 changed files with 8 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2013-11-01 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/term/serial.c (options), (grub_cmd_serial): Fix handling
of SI suffixes.
2013-11-01 Vladimir Serbinenko <phcoder@gmail.com> 2013-11-01 Vladimir Serbinenko <phcoder@gmail.com>
Support --base-clock for serial command to handle weird cards with Support --base-clock for serial command to handle weird cards with

View file

@ -59,7 +59,7 @@ static const struct grub_arg_option options[] =
{"word", 'w', 0, N_("Set the serial port word length."), 0, ARG_TYPE_INT}, {"word", 'w', 0, N_("Set the serial port word length."), 0, ARG_TYPE_INT},
{"parity", 'r', 0, N_("Set the serial port parity."), 0, ARG_TYPE_STRING}, {"parity", 'r', 0, N_("Set the serial port parity."), 0, ARG_TYPE_STRING},
{"stop", 't', 0, N_("Set the serial port stop bits."), 0, ARG_TYPE_INT}, {"stop", 't', 0, N_("Set the serial port stop bits."), 0, ARG_TYPE_INT},
{"base-clock", 'b', 0, N_("Set the base clock."), 0, ARG_TYPE_INT}, {"base-clock", 'b', 0, N_("Set the base clock."), 0, ARG_TYPE_STRING},
{0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0}
}; };
@ -254,6 +254,8 @@ grub_cmd_serial (grub_extcmd_context_t ctxt, int argc, char **args)
{ {
char *ptr; char *ptr;
config.base_clock = grub_strtoull (state[OPTION_BASE_CLOCK].arg, &ptr, 0); config.base_clock = grub_strtoull (state[OPTION_BASE_CLOCK].arg, &ptr, 0);
if (grub_errno)
return grub_errno;
if (ptr && *ptr == 'M') if (ptr && *ptr == 'M')
config.base_clock *= 1000000; config.base_clock *= 1000000;
if (ptr && (*ptr == 'k' || *ptr == 'K')) if (ptr && (*ptr == 'k' || *ptr == 'K'))