mgmt: hawkbit: add shell autohandler timeout Kconfig

Add shell autohandler timeout configuration option.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
This commit is contained in:
Fin Maaß 2025-05-12 12:14:24 +02:00 committed by Benjamin Cabé
commit bf111b44ad
2 changed files with 17 additions and 1 deletions

View file

@ -47,6 +47,17 @@ config HAWKBIT_SHELL
help help
Activate shell module that provides hawkBit commands. Activate shell module that provides hawkBit commands.
config HAWKBIT_SHELL_AUTOHANDLER_TIMEOUT
int "hawkBit shell autohandler timeout"
default 200
depends on HAWKBIT_SHELL
help
Set the timeout in milliseconds for the hawkBit shell autohandler. During
the timeout, the hawkBit shell autohandler blocks the shell and waits for
the hawkBit autohandler to finish. During this time, log messages for the
shell logger are not printed, so this timeout should be set to a value that
is not too long, to not drop the logs.
config HAWKBIT_TENANT config HAWKBIT_TENANT
string "Tenant name for the hawkbit server" string "Tenant name for the hawkbit server"
default "default" default "default"

View file

@ -27,7 +27,8 @@ static void cmd_run(const struct shell *sh, size_t argc, char **argv)
hawkbit_autohandler(false); hawkbit_autohandler(false);
switch (hawkbit_autohandler_wait(UINT32_MAX, K_FOREVER)) { switch (hawkbit_autohandler_wait(UINT32_MAX,
K_MSEC(CONFIG_HAWKBIT_SHELL_AUTOHANDLER_TIMEOUT))) {
case HAWKBIT_UNCONFIRMED_IMAGE: case HAWKBIT_UNCONFIRMED_IMAGE:
shell_error(sh, "Image is unconfirmed." shell_error(sh, "Image is unconfirmed."
"Rebooting to revert back to previous confirmed image"); "Rebooting to revert back to previous confirmed image");
@ -57,6 +58,10 @@ static void cmd_run(const struct shell *sh, size_t argc, char **argv)
shell_error(sh, "hawkBit not initialized"); shell_error(sh, "hawkBit not initialized");
break; break;
case HAWKBIT_NO_RESPONSE:
shell_info(sh, "hawkBit is still running, see log for more information");
break;
default: default:
shell_error(sh, "Invalid response"); shell_error(sh, "Invalid response");
break; break;