]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
terminal: add ply_terminal_get_capslock_state function
authorHans de Goede <hdegoede@redhat.com>
Mon, 23 Sep 2019 12:30:33 +0000 (14:30 +0200)
committerHans de Goede <hdegoede@redhat.com>
Tue, 24 Sep 2019 06:16:05 +0000 (08:16 +0200)
Add a helper function to get the capslock-state from the terminal.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
src/libply-splash-core/ply-terminal.c
src/libply-splash-core/ply-terminal.h

index 0190f9eccfeefd570862bf5ca38e25421a3aa1c5..2a19579d2b20369301c6e43bd494bafb22f15c31 100644 (file)
@@ -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)
 {
index 620ee9e6c461f1d25159d5c5d340f2083852ee07..3ca1dc0c57aad348dfa4c1b2f85fd3de96a0bd7c 100644 (file)
@@ -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);