From 2bc0df4aa35a89c5af7e54f459e2bbde20ca6a7e Mon Sep 17 00:00:00 2001 From: Samuel Mendoza-Jonas Date: Tue, 6 Nov 2018 15:34:51 +1100 Subject: 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 --- lib/pb-protocol/pb-protocol.c | 9 ++++++++- lib/types/types.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c index 315efc4..7c563c8 100644 --- a/lib/pb-protocol/pb-protocol.c +++ b/lib/pb-protocol/pb-protocol.c @@ -223,7 +223,7 @@ int pb_protocol_boot_status_len(const struct status *status) return 4 + /* type */ 4 + optional_strlen(status->message) + 4 + /* backlog */ - 4; + 4; /* boot_active */ } int pb_protocol_system_info_len(const struct system_info *sysinfo) @@ -457,6 +457,9 @@ int pb_protocol_serialise_boot_status(const struct status *status, *(bool *)pos = __cpu_to_be32(status->backlog); pos += sizeof(bool); + *(bool *)pos = __cpu_to_be32(status->boot_active); + pos += sizeof(bool); + assert(pos <= buf + buf_len); (void)buf_len; @@ -952,6 +955,10 @@ int pb_protocol_deserialise_boot_status(struct status *status, status->backlog = *(bool *)pos; pos += sizeof(status->backlog); + /* boot_active */ + status->boot_active = *(bool *)pos; + pos += sizeof(status->boot_active); + rc = 0; out: diff --git a/lib/types/types.h b/lib/types/types.h index 5f99b58..f5392c8 100644 --- a/lib/types/types.h +++ b/lib/types/types.h @@ -97,6 +97,7 @@ struct status { } type; char *message; bool backlog; + bool boot_active; }; struct statuslog_entry { -- cgit v1.2.1