From: g0tar Date: Wed, 30 Aug 2017 08:00:44 +0000 (+0200) Subject: terminal reset should honour default_utf8 kernel setting (#6606) X-Git-Tag: v235~217 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=73e669e0fde6b9aabec48327d95c875a70555d34;p=platform%2Fupstream%2Fsystemd.git terminal reset should honour default_utf8 kernel setting (#6606) terminal reset should honour default_utf8 kernel setting --- diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c index d665a18..0a1638b 100644 --- a/src/basic/terminal-util.c +++ b/src/basic/terminal-util.c @@ -245,6 +245,8 @@ int ask_string(char **ret, const char *text, ...) { int reset_terminal_fd(int fd, bool switch_to_text) { struct termios termios; + _cleanup_free_ char *utf8 = NULL; + int kb; int r = 0; /* Set terminal to some sane defaults */ @@ -262,8 +264,12 @@ int reset_terminal_fd(int fd, bool switch_to_text) { if (switch_to_text) (void) ioctl(fd, KDSETMODE, KD_TEXT); - /* Enable console unicode mode */ - (void) ioctl(fd, KDSKBMODE, K_UNICODE); + /* Set default keyboard mode */ + if (read_one_line_file("/sys/module/vt/parameters/default_utf8", &utf8) >= 0 && parse_boolean(utf8) == 0) + kb = K_XLATE; + else + kb = K_UNICODE; + (void) ioctl(fd, KDSKBMODE, kb); if (tcgetattr(fd, &termios) < 0) { r = -errno; diff --git a/src/login/logind-session.c b/src/login/logind-session.c index 3778bb7..c345b1c 100644 --- a/src/login/logind-session.c +++ b/src/login/logind-session.c @@ -1156,10 +1156,10 @@ void session_restore_vt(Session *s) { (void) ioctl(vt, KDSETMODE, KD_TEXT); - if (read_one_line_file("/sys/module/vt/parameters/default_utf8", &utf8) >= 0 && *utf8 == '1') - kb = K_UNICODE; - else + if (read_one_line_file("/sys/module/vt/parameters/default_utf8", &utf8) >= 0 && parse_boolean(utf8) == 0) kb = K_XLATE; + else + kb = K_UNICODE; (void) ioctl(vt, KDSKBMODE, kb);