summaryrefslogtreecommitdiffstats
path: root/discover
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>2018-11-06 15:34:51 +1100
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>2018-11-16 13:55:29 +1100
commit2bc0df4aa35a89c5af7e54f459e2bbde20ca6a7e (patch)
treea66664ea5f4d51c8c1b92033843d5d75f50d7cef /discover
parent646d77d8156ad72da1c24f734a029a525ba4bed9 (diff)
downloadtalos-petitboot-2bc0df4aa35a89c5af7e54f459e2bbde20ca6a7e.tar.gz
talos-petitboot-2bc0df4aa35a89c5af7e54f459e2bbde20ca6a7e.zip
ui/ncurses: Reset console options on boot
The ncurses UI sets a few console options at startup that are needed for ncurses to work properly. These aren't reset however and can lead to quirks like the cursor being invisible after kexecing to the next kernel. The UI process doesn't have time to reset these when it is killed by kexec, so instead add a 'boot_active' field to status updates. This is set by boot.c's update handler so the UI can assume it is about to boot if it receives a status update with this field, and resets the console options. If the boot is cancelled for any reason the status update will reflect that and the console options are restored. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Diffstat (limited to 'discover')
-rw-r--r--discover/boot.c7
-rw-r--r--discover/device-handler.c1
2 files changed, 5 insertions, 3 deletions
diff --git a/discover/boot.c b/discover/boot.c
index 3de7d28..ed67cd5 100644
--- a/discover/boot.c
+++ b/discover/boot.c
@@ -46,6 +46,7 @@ static void __attribute__((format(__printf__, 4, 5))) update_status(
status.type = type;
status.backlog = false;
+ status.boot_active = type == STATUS_INFO;
pb_debug("boot status: [%d] %s\n", type, status.message);
@@ -531,7 +532,7 @@ struct boot_task *boot(void *ctx, struct discover_boot_option *opt,
image = opt->boot_image->url;
} else {
pb_log_fn("no image specified\n");
- update_status(status_fn, status_arg, STATUS_INFO,
+ update_status(status_fn, status_arg, STATUS_ERROR,
_("Boot failed: no image specified"));
return NULL;
}
@@ -585,7 +586,7 @@ struct boot_task *boot(void *ctx, struct discover_boot_option *opt,
} else {
pb_log("%s: no command line signature file"
" specified\n", __func__);
- update_status(status_fn, status_arg, STATUS_INFO,
+ update_status(status_fn, status_arg, STATUS_ERROR,
_("Boot failed: no command line"
" signature file specified"));
talloc_free(boot_task);
@@ -654,7 +655,7 @@ void boot_cancel(struct boot_task *task)
{
task->cancelled = true;
- update_status(task->status_fn, task->status_arg, STATUS_INFO,
+ update_status(task->status_fn, task->status_arg, STATUS_ERROR,
_("Boot cancelled"));
cleanup_cancellations(task, NULL);
diff --git a/discover/device-handler.c b/discover/device-handler.c
index 983c509..271b988 100644
--- a/discover/device-handler.c
+++ b/discover/device-handler.c
@@ -534,6 +534,7 @@ static void _device_handler_vstatus(struct device_handler *handler,
status.type = type;
status.message = talloc_vasprintf(handler, fmt, ap);
status.backlog = false;
+ status.boot_active = false;
device_handler_status(handler, &status);
OpenPOWER on IntegriCloud