1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-11-29 21:12:06 +00:00

config: add clamping of bootwait

This commit is contained in:
CTCaer 2021-08-28 17:57:36 +03:00
parent 9d69c9bd3f
commit f61e284ac0
2 changed files with 17 additions and 0 deletions

View file

@ -846,7 +846,17 @@ static void _auto_launch_firmware()
else if (!strcmp("autoboot_list", kv->key)) else if (!strcmp("autoboot_list", kv->key))
h_cfg.autoboot_list = atoi(kv->val); h_cfg.autoboot_list = atoi(kv->val);
else if (!strcmp("bootwait", kv->key)) else if (!strcmp("bootwait", kv->key))
{
h_cfg.bootwait = atoi(kv->val); h_cfg.bootwait = atoi(kv->val);
/*
* Clamp value to default if it exceeds 20s.
* Allow up to 20s though for use in cases where user needs lots of time.
* For example dock-only use and r2p with enough time to rach dock and cancel it.
*/
if (h_cfg.bootwait > 20)
h_cfg.bootwait = 3;
}
else if (!strcmp("backlight", kv->key)) else if (!strcmp("backlight", kv->key))
h_cfg.backlight = atoi(kv->val); h_cfg.backlight = atoi(kv->val);
else if (!strcmp("autohosoff", kv->key)) else if (!strcmp("autohosoff", kv->key))

View file

@ -105,6 +105,13 @@ int create_config_entry()
f_puts("\nautoboot_list=", &fp); f_puts("\nautoboot_list=", &fp);
itoa(h_cfg.autoboot_list, lbuf, 10); itoa(h_cfg.autoboot_list, lbuf, 10);
f_puts(lbuf, &fp); f_puts(lbuf, &fp);
/*
* Clamp value to default if it exceeds 20s.
* Allow up to 20s though for use in cases where user needs lots of time.
* For example dock-only use and r2p with enough time to reach dock and cancel it.
*/
if (h_cfg.bootwait > 20)
h_cfg.bootwait = 3;
f_puts("\nbootwait=", &fp); f_puts("\nbootwait=", &fp);
itoa(h_cfg.bootwait, lbuf, 10); itoa(h_cfg.bootwait, lbuf, 10);
f_puts(lbuf, &fp); f_puts(lbuf, &fp);