From: Hans de Goede Date: Mon, 23 Sep 2019 12:30:33 +0000 (+0200) Subject: terminal: add ply_terminal_get_capslock_state function X-Git-Tag: 0.9.5~38^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f49ef3fe655b1ac94ddafd5a4ca325b7b070d7b;p=thirdparty%2Fplymouth.git terminal: add ply_terminal_get_capslock_state function Add a helper function to get the capslock-state from the terminal. Signed-off-by: Hans de Goede --- diff --git a/src/libply-splash-core/ply-terminal.c b/src/libply-splash-core/ply-terminal.c index 0190f9ec..2a19579d 100644 --- a/src/libply-splash-core/ply-terminal.c +++ b/src/libply-splash-core/ply-terminal.c @@ -855,6 +855,17 @@ ply_terminal_get_name (ply_terminal_t *terminal) return terminal->name; } +bool +ply_terminal_get_capslock_state (ply_terminal_t *terminal) +{ + char state; + + if (ioctl (terminal->fd, KDGETLED, &state) < 0) + return false; + + return (state & LED_CAP); +} + int ply_terminal_get_vt_number (ply_terminal_t *terminal) { diff --git a/src/libply-splash-core/ply-terminal.h b/src/libply-splash-core/ply-terminal.h index 620ee9e6..3ca1dc0c 100644 --- a/src/libply-splash-core/ply-terminal.h +++ b/src/libply-splash-core/ply-terminal.h @@ -93,6 +93,7 @@ void ply_terminal_ignore_mode_changes (ply_terminal_t *terminal, bool should_ignore); const char *ply_terminal_get_name (ply_terminal_t *terminal); +bool ply_terminal_get_capslock_state (ply_terminal_t *terminal); int ply_terminal_get_vt_number (ply_terminal_t *terminal); bool ply_terminal_activate_vt (ply_terminal_t *terminal); bool ply_terminal_deactivate_vt (ply_terminal_t *terminal);