vconsole-setup.c revision b92bea5d2a9481de69bb627a7b442a9f58fca43d
988d399c4943f830cc91ff3fedfd29f4b6f6bf7fnilgun/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
988d399c4943f830cc91ff3fedfd29f4b6f6bf7fnilgun This file is part of systemd.
988d399c4943f830cc91ff3fedfd29f4b6f6bf7fnilgun Copyright 2010 Kay Sievers
988d399c4943f830cc91ff3fedfd29f4b6f6bf7fnilgun systemd is free software; you can redistribute it and/or modify it
988d399c4943f830cc91ff3fedfd29f4b6f6bf7fnilgun under the terms of the GNU Lesser General Public License as published by
988d399c4943f830cc91ff3fedfd29f4b6f6bf7fnilgun the Free Software Foundation; either version 2.1 of the License, or
988d399c4943f830cc91ff3fedfd29f4b6f6bf7fnilgun (at your option) any later version.
988d399c4943f830cc91ff3fedfd29f4b6f6bf7fnilgun systemd is distributed in the hope that it will be useful, but
988d399c4943f830cc91ff3fedfd29f4b6f6bf7fnilgun WITHOUT ANY WARRANTY; without even the implied warranty of
988d399c4943f830cc91ff3fedfd29f4b6f6bf7fnilgun MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
988d399c4943f830cc91ff3fedfd29f4b6f6bf7fnilgun Lesser General Public License for more details.
988d399c4943f830cc91ff3fedfd29f4b6f6bf7fnilgun You should have received a copy of the GNU Lesser General Public License
988d399c4943f830cc91ff3fedfd29f4b6f6bf7fnilgun along with systemd; If not, see <http://www.gnu.org/licenses/>.
988d399c4943f830cc91ff3fedfd29f4b6f6bf7fnilgun int r = 0, k;
988d399c4943f830cc91ff3fedfd29f4b6f6bf7fnilgun k = write_string_file("/sys/module/vt/parameters/default_utf8", "0");
988d399c4943f830cc91ff3fedfd29f4b6f6bf7fnilgun log_warning("Failed to disable UTF-8: %s", strerror(-r));
988d399c4943f830cc91ff3fedfd29f4b6f6bf7fnilgun int r = 0, k;
988d399c4943f830cc91ff3fedfd29f4b6f6bf7fnilgun if (ioctl(fd, KDGKBMODE, ¤t) < 0 || current == K_XLATE) {
988d399c4943f830cc91ff3fedfd29f4b6f6bf7fnilgun * Change the current keyboard to unicode, unless it
988d399c4943f830cc91ff3fedfd29f4b6f6bf7fnilgun * is currently in raw or off mode anyway. We
988d399c4943f830cc91ff3fedfd29f4b6f6bf7fnilgun * shouldn't interfere with X11's processing of the
988d399c4943f830cc91ff3fedfd29f4b6f6bf7fnilgun * key events.
988d399c4943f830cc91ff3fedfd29f4b6f6bf7fnilgun * http://lists.freedesktop.org/archives/systemd-devel/2013-February/008573.html
988d399c4943f830cc91ff3fedfd29f4b6f6bf7fnilgun k = write_string_file("/sys/module/vt/parameters/default_utf8", "1");
static int keymap_load(const char *vc, const char *map, const char *map_toggle, bool utf8, pid_t *_pid) {
*_pid = 0;
if (utf8)
if (map_toggle)
if (pid < 0) {
return -errno;
} else if (pid == 0) {
static int font_load(const char *vc, const char *font, const char *map, const char *unimap, pid_t *_pid) {
*_pid = 0;
if (map) {
if (unimap) {
if (pid < 0) {
return -errno;
} else if (pid == 0) {
* font. It also allows to restart systemd-vconsole-setup.service,
if (vcfd < 0)
const char *vc;
bool utf8;
bool font_copy = false;
int r = EXIT_FAILURE;
log_open();
font_copy = true;
if (fd < 0) {
goto finish;
goto finish;
NULL);
if (r < 0 && r != -ENOENT)
/* Let the kernel command line override /etc/vconsole.conf */
NULL);
if (r < 0 && r != -ENOENT)
if (utf8)
r = EXIT_FAILURE;
r = EXIT_SUCCESS;
if (keymap_pid > 0)
if (font_pid > 0) {
if (font_copy)
if (fd >= 0)