From f61e284ac08247276422e9f279259df514acfe5e Mon Sep 17 00:00:00 2001 From: CTCaer Date: Sat, 28 Aug 2021 17:57:36 +0300 Subject: [PATCH] config: add clamping of bootwait --- bootloader/main.c | 10 ++++++++++ nyx/nyx_gui/config.c | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/bootloader/main.c b/bootloader/main.c index 7af6196..7d518de 100644 --- a/bootloader/main.c +++ b/bootloader/main.c @@ -846,7 +846,17 @@ static void _auto_launch_firmware() else if (!strcmp("autoboot_list", kv->key)) h_cfg.autoboot_list = atoi(kv->val); else if (!strcmp("bootwait", kv->key)) + { 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)) h_cfg.backlight = atoi(kv->val); else if (!strcmp("autohosoff", kv->key)) diff --git a/nyx/nyx_gui/config.c b/nyx/nyx_gui/config.c index 538439a..362ad81 100644 --- a/nyx/nyx_gui/config.c +++ b/nyx/nyx_gui/config.c @@ -105,6 +105,13 @@ int create_config_entry() f_puts("\nautoboot_list=", &fp); itoa(h_cfg.autoboot_list, lbuf, 10); 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); itoa(h_cfg.bootwait, lbuf, 10); f_puts(lbuf, &fp);