* grub-core/commands/i386/cmostest.c: Add new command "cmosset".

Tested by: Denis 'GNUtoo' Carikli.
This commit is contained in:
Vladimir Serbinenko 2013-11-09 17:27:49 +01:00
parent 800f63d38f
commit 3c98038174
2 changed files with 29 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2013-11-09 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/commands/i386/cmostest.c: Add new command "cmosset".
Tested by: Denis 'GNUtoo' Carikli.
2013-11-08 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/normal/datetime.c (grub_get_weekday): Use unsigned types.

View file

@ -81,7 +81,25 @@ grub_cmd_cmosclean (struct grub_command *cmd __attribute__ ((unused)),
return grub_cmos_write (byte, value & (~(1 << bit)));
}
static grub_command_t cmd, cmd_clean;
static grub_err_t
grub_cmd_cmosset (struct grub_command *cmd __attribute__ ((unused)),
int argc, char *argv[])
{
int byte, bit;
grub_err_t err;
grub_uint8_t value;
err = parse_args (argc, argv, &byte, &bit);
if (err)
return err;
err = grub_cmos_read (byte, &value);
if (err)
return err;
return grub_cmos_write (byte, value | (1 << bit));
}
static grub_command_t cmd, cmd_clean, cmd_set;
GRUB_MOD_INIT(cmostest)
@ -92,10 +110,14 @@ GRUB_MOD_INIT(cmostest)
cmd_clean = grub_register_command ("cmosclean", grub_cmd_cmosclean,
N_("BYTE:BIT"),
N_("Clean bit at BYTE:BIT in CMOS."));
cmd_set = grub_register_command ("cmosset", grub_cmd_cmosset,
N_("BYTE:BIT"),
N_("Set bit at BYTE:BIT in CMOS."));
}
GRUB_MOD_FINI(cmostest)
{
grub_unregister_command (cmd);
grub_unregister_command (cmd_clean);
grub_unregister_command (cmd_set);
}