From: nerdopolis Date: Fri, 8 Dec 2023 15:31:41 +0000 (-0500) Subject: When using input devices, set the VT keyboard state with KDSKBMODE so that the VT... X-Git-Tag: 23.51.283~6^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6b79792829b2713bf4fab588622f102590736764;p=thirdparty%2Fplymouth.git When using input devices, set the VT keyboard state with KDSKBMODE so that the VT console doesn't change the LED state --- diff --git a/src/libply-splash-core/ply-terminal.c b/src/libply-splash-core/ply-terminal.c index f3fbcebb..51280bc0 100644 --- a/src/libply-splash-core/ply-terminal.c +++ b/src/libply-splash-core/ply-terminal.c @@ -103,6 +103,7 @@ struct _ply_terminal uint32_t is_open : 1; uint32_t is_active : 1; uint32_t is_unbuffered : 1; + uint32_t is_disabled : 1; uint32_t is_watching_for_vt_changes : 1; uint32_t should_ignore_mode_changes : 1; }; @@ -240,6 +241,11 @@ ply_terminal_set_unbuffered_input (ply_terminal_t *terminal) ply_terminal_unlock (terminal); + terminal->is_disabled = false; + + if (ply_terminal_is_vt (terminal)) + ioctl (terminal->fd, KDSKBMODE, K_UNICODE); + tcgetattr (terminal->fd, &term_attributes); if (!terminal->original_term_attributes_saved) { @@ -270,6 +276,11 @@ ply_terminal_set_buffered_input (ply_terminal_t *terminal) { struct termios term_attributes; + terminal->is_disabled = false; + + if (ply_terminal_is_vt (terminal)) + ioctl (terminal->fd, KDSKBMODE, K_UNICODE); + if (!terminal->is_unbuffered) return true; @@ -310,6 +321,17 @@ ply_terminal_set_buffered_input (ply_terminal_t *terminal) return true; } +bool +ply_terminal_set_disabled_input (ply_terminal_t *terminal) +{ + terminal->is_disabled = true; + + if (ply_terminal_is_vt (terminal)) + ioctl (terminal->fd, KDSKBMODE, K_OFF); + + return true; +} + void ply_terminal_write (ply_terminal_t *terminal, const char *format, @@ -369,6 +391,11 @@ on_tty_input (ply_terminal_t *terminal) { ply_list_node_t *node; + if (terminal->is_disabled) { + ply_terminal_flush_input (terminal); + return; + } + node = ply_list_get_first_node (terminal->input_closures); while (node != NULL) { ply_terminal_input_closure_t *closure; diff --git a/src/libply-splash-core/ply-terminal.h b/src/libply-splash-core/ply-terminal.h index 14d75d13..8536f4a9 100644 --- a/src/libply-splash-core/ply-terminal.h +++ b/src/libply-splash-core/ply-terminal.h @@ -70,6 +70,7 @@ void ply_terminal_reset_colors (ply_terminal_t *terminal); bool ply_terminal_set_unbuffered_input (ply_terminal_t *terminal); bool ply_terminal_set_buffered_input (ply_terminal_t *terminal); +bool ply_terminal_set_disabled_input (ply_terminal_t *terminal); bool ply_terminal_refresh_geometry (ply_terminal_t *terminal); __attribute__((__format__ (__printf__, 2, 3))) diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c index a410be07..043d024a 100644 --- a/src/plugins/renderers/drm/plugin.c +++ b/src/plugins/renderers/drm/plugin.c @@ -1719,7 +1719,12 @@ flush_head (ply_renderer_backend_t *backend, if (backend->terminal != NULL) { ply_terminal_set_mode (backend->terminal, PLY_TERMINAL_MODE_GRAPHICS); - ply_terminal_set_unbuffered_input (backend->terminal); + + if (using_input_device (&backend->input_source)) { + ply_terminal_set_disabled_input (backend->terminal); + } else { + ply_terminal_set_unbuffered_input (backend->terminal); + } } pixel_buffer = head->pixel_buffer; updated_region = ply_pixel_buffer_get_updated_areas (pixel_buffer); diff --git a/src/plugins/renderers/frame-buffer/plugin.c b/src/plugins/renderers/frame-buffer/plugin.c index 149c3333..2141990a 100644 --- a/src/plugins/renderers/frame-buffer/plugin.c +++ b/src/plugins/renderers/frame-buffer/plugin.c @@ -590,7 +590,12 @@ flush_head (ply_renderer_backend_t *backend, if (backend->terminal != NULL) { ply_terminal_set_mode (backend->terminal, PLY_TERMINAL_MODE_GRAPHICS); - ply_terminal_set_unbuffered_input (backend->terminal); + + if (using_input_device (&backend->input_source)) { + ply_terminal_set_disabled_input (backend->terminal); + } else { + ply_terminal_set_unbuffered_input (backend->terminal); + } } pixel_buffer = head->pixel_buffer; updated_region = ply_pixel_buffer_get_updated_areas (pixel_buffer);