From bb5ac84d79ac3aef606a4a9eeaafef94a1f199be Mon Sep 17 00:00:00 2001 From: Balint Reczey Date: Wed, 24 Apr 2019 16:35:32 +0200 Subject: Move verify_vc_kbmode() to terminal-util.c as vt_verify_kbmode() --- src/vconsole/vconsole-setup.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'src/vconsole') diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c index 67dc2e49f9..1feb8d9370 100644 --- a/src/vconsole/vconsole-setup.c +++ b/src/vconsole/vconsole-setup.c @@ -70,23 +70,6 @@ static int verify_vc_allocation_byfd(int fd) { return verify_vc_allocation(vcs.v_active); } -static int verify_vc_kbmode(int fd) { - int curr_mode; - - /* - * Make sure we only adjust consoles in K_XLATE or K_UNICODE mode. - * Otherwise we would (likely) interfere with X11's processing of the - * key events. - * - * http://lists.freedesktop.org/archives/systemd-devel/2013-February/008573.html - */ - - if (ioctl(fd, KDGKBMODE, &curr_mode) < 0) - return -errno; - - return IN_SET(curr_mode, K_XLATE, K_UNICODE) ? 0 : -EBUSY; -} - static int toggle_utf8(const char *name, int fd, bool utf8) { int r; struct termios tc = {}; @@ -290,7 +273,7 @@ static void setup_remaining_vcs(int src_fd, unsigned src_idx, bool utf8) { continue; } - if (verify_vc_kbmode(fd_d) < 0) + if (vt_verify_kbmode(fd_d) < 0) continue; toggle_utf8(ttyname, fd_d, utf8); @@ -365,7 +348,7 @@ static int find_source_vc(char **ret_path, unsigned *ret_idx) { err = -fd; continue; } - r = verify_vc_kbmode(fd); + r = vt_verify_kbmode(fd); if (r < 0) { if (!err) err = -r; @@ -398,7 +381,7 @@ static int verify_source_vc(char **ret_path, const char *src_vc) { if (r < 0) return log_error_errno(r, "Virtual console %s is not allocated: %m", src_vc); - r = verify_vc_kbmode(fd); + r = vt_verify_kbmode(fd); if (r < 0) return log_error_errno(r, "Virtual console %s is not in K_XLATE or K_UNICODE: %m", src_vc); -- cgit v1.2.1