diff options
author | Lennart Poettering <lennart@poettering.net> | 2019-07-18 16:01:07 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2019-07-18 16:21:02 +0200 |
commit | 26382cab1b1a030f68b987fdd6cd374490f2b484 (patch) | |
tree | b55a62a9f10d9dcc5a6fdf927cf39da5182a54ef /src/vconsole | |
parent | Revert "Add check to switch VTs only between K_XLATE or K_UNICODE" (diff) | |
download | systemd-26382cab1b1a030f68b987fdd6cd374490f2b484.tar.xz systemd-26382cab1b1a030f68b987fdd6cd374490f2b484.zip |
Revert "Move verify_vc_kbmode() to terminal-util.c as vt_verify_kbmode()"
This reverts commit bb5ac84d79ac3aef606a4a9eeaafef94a1f199be.
Diffstat (limited to 'src/vconsole')
-rw-r--r-- | src/vconsole/vconsole-setup.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c index 42150be8e9..976dd825bc 100644 --- a/src/vconsole/vconsole-setup.c +++ b/src/vconsole/vconsole-setup.c @@ -70,6 +70,23 @@ 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 = {}; @@ -273,7 +290,7 @@ static void setup_remaining_vcs(int src_fd, unsigned src_idx, bool utf8) { continue; } - if (vt_verify_kbmode(fd_d) < 0) + if (verify_vc_kbmode(fd_d) < 0) continue; toggle_utf8(ttyname, fd_d, utf8); @@ -348,7 +365,7 @@ static int find_source_vc(char **ret_path, unsigned *ret_idx) { err = -fd; continue; } - r = vt_verify_kbmode(fd); + r = verify_vc_kbmode(fd); if (r < 0) { if (!err) err = -r; @@ -381,7 +398,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 = vt_verify_kbmode(fd); + r = verify_vc_kbmode(fd); if (r < 0) return log_error_errno(r, "Virtual console %s is not in K_XLATE or K_UNICODE: %m", src_vc); |