mirror of
https://github.com/systemd/systemd.git
synced 2025-03-19 22:50:17 +03:00
terminal reset should honour default_utf8 kernel setting (#6606)
terminal reset should honour default_utf8 kernel setting
This commit is contained in:
parent
40cdf0c962
commit
73e669e0fd
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user