2013-01-09 10:46:41 +01:00
|
|
|
Index: systemd-195/src/vconsole/vconsole-setup.c
|
2012-04-20 17:46:37 +02:00
|
|
|
===================================================================
|
2013-01-09 10:46:41 +01:00
|
|
|
--- systemd-195.orig/src/vconsole/vconsole-setup.c
|
|
|
|
+++ systemd-195/src/vconsole/vconsole-setup.c
|
2012-10-26 14:34:44 +02:00
|
|
|
@@ -287,12 +287,14 @@ int main(int argc, char **argv) {
|
2012-04-20 17:46:37 +02:00
|
|
|
char *vc_kbd_delay = NULL;
|
|
|
|
char *vc_kbd_rate = NULL;
|
|
|
|
char *vc_kbd_disable_caps_lock = NULL;
|
|
|
|
+ char *vc_kbd_numlock = NULL;
|
|
|
|
char *vc_compose_table = NULL;
|
|
|
|
pid_t kbd_rate_pid = 0, compose_table_pid = 0;
|
|
|
|
#endif
|
|
|
|
int fd = -1;
|
|
|
|
bool utf8;
|
|
|
|
bool disable_capslock = false;
|
|
|
|
+ bool numlock = false;
|
|
|
|
int r = EXIT_FAILURE;
|
|
|
|
pid_t font_pid = 0, keymap_pid = 0;
|
|
|
|
|
2013-01-09 10:46:41 +01:00
|
|
|
@@ -380,6 +382,37 @@ int main(int argc, char **argv) {
|
2012-10-26 14:34:44 +02:00
|
|
|
vc_keymap = t;
|
2012-04-20 17:46:37 +02:00
|
|
|
}
|
|
|
|
disable_capslock = vc_kbd_disable_caps_lock && strcasecmp(vc_kbd_disable_caps_lock, "YES") == 0;
|
|
|
|
+ if (vc_kbd_numlock && strcasecmp(vc_kbd_numlock, "BIOS") == 0) {
|
|
|
|
+ int hwinfo_fd[2];
|
|
|
|
+ pid_t hwinfo_pid;
|
|
|
|
+
|
|
|
|
+ pipe(hwinfo_fd);
|
|
|
|
+ if ((hwinfo_pid = fork()) < 0) {
|
|
|
|
+ log_error("Failed to fork: %m");
|
|
|
|
+ _exit(EXIT_FAILURE);
|
|
|
|
+ } else if (hwinfo_pid == 0) {
|
|
|
|
+ const char *args[3];
|
|
|
|
+ int i = 0;
|
|
|
|
+ args[i++] = HWINFO;
|
|
|
|
+ args[i++] = "--bios";
|
|
|
|
+ args[i++] = NULL;
|
|
|
|
+ close(hwinfo_fd[0]);
|
|
|
|
+ fclose(stdout);
|
|
|
|
+ dup2(hwinfo_fd[1], STDOUT_FILENO);
|
|
|
|
+ execv(args[0], (char **) args);
|
|
|
|
+ _exit(EXIT_FAILURE);
|
|
|
|
+ } else {
|
|
|
|
+ char line[17];
|
|
|
|
+ FILE *hwinfo_file = fdopen(hwinfo_fd[0], "r");
|
|
|
|
+ close(hwinfo_fd[1]);
|
|
|
|
+ while (fgets(line, 17, hwinfo_file))
|
|
|
|
+ if (strstr(line, "Num Lock: on"))
|
|
|
|
+ numlock = true;
|
|
|
|
+ close(hwinfo_fd[0]);
|
|
|
|
+ fclose(hwinfo_file);
|
|
|
|
+ }
|
|
|
|
+ } else
|
|
|
|
+ numlock = vc_kbd_numlock && strcasecmp(vc_kbd_numlock, "YES") == 0;
|
|
|
|
|
2012-10-26 14:34:44 +02:00
|
|
|
#elif defined(TARGET_SUSE)
|
|
|
|
r = parse_env_file("/etc/sysconfig/keyboard", NEWLINE,
|
2013-01-09 10:46:41 +01:00
|
|
|
@@ -387,6 +420,7 @@ int main(int argc, char **argv) {
|
2012-10-26 14:34:44 +02:00
|
|
|
"KBD_DELAY", &vc_kbd_delay,
|
|
|
|
"KBD_RATE", &vc_kbd_rate,
|
|
|
|
"KBD_DISABLE_CAPS_LOCK", &vc_kbd_disable_caps_lock,
|
|
|
|
+ "KBD_NUMLOCK", &vc_kbd_numlock,
|
|
|
|
"COMPOSETABLE", &vc_compose_table,
|
|
|
|
NULL);
|
|
|
|
if (r < 0 && r != -ENOENT)
|
2013-01-09 10:46:41 +01:00
|
|
|
@@ -557,6 +591,10 @@ int main(int argc, char **argv) {
|
2012-04-20 17:46:37 +02:00
|
|
|
finish:
|
|
|
|
if (keymap_pid > 0)
|
|
|
|
wait_for_terminate_and_warn(KBD_LOADKEYS, keymap_pid);
|
|
|
|
+ if (numlock)
|
|
|
|
+ close(open("/run/numlock-on", O_WRONLY|O_CREAT, 0644));
|
|
|
|
+ else
|
|
|
|
+ unlink("/run/numlock-on");
|
|
|
|
|
|
|
|
#ifdef TARGET_SUSE
|
|
|
|
if (compose_table_pid > 0)
|
2013-01-09 10:46:41 +01:00
|
|
|
Index: systemd-195/Makefile.am
|
2012-04-20 17:46:37 +02:00
|
|
|
===================================================================
|
2013-01-09 10:46:41 +01:00
|
|
|
--- systemd-195.orig/Makefile.am
|
|
|
|
+++ systemd-195/Makefile.am
|
|
|
|
@@ -2017,6 +2017,19 @@ dist_udevrules_DATA += \
|
2012-10-26 14:34:44 +02:00
|
|
|
rules/61-accelerometer.rules
|
2012-07-04 11:05:59 +02:00
|
|
|
|
2012-10-26 14:34:44 +02:00
|
|
|
# ------------------------------------------------------------------------------
|
2012-07-04 11:05:59 +02:00
|
|
|
+numlock_on_SOURCES = \
|
|
|
|
+ src/login/numlock-on.c
|
|
|
|
+
|
|
|
|
+numlock_on_CFLAGS = \
|
|
|
|
+ $(AM_CFLAGS)
|
|
|
|
+
|
2012-10-26 14:34:44 +02:00
|
|
|
+udevlibexec_PROGRAMS += \
|
|
|
|
+ numlock-on
|
|
|
|
+
|
|
|
|
+dist_udevrules_DATA += \
|
|
|
|
+ rules/73-seat-numlock.rules
|
|
|
|
+
|
|
|
|
+# ------------------------------------------------------------------------------
|
|
|
|
if ENABLE_GUDEV
|
|
|
|
if ENABLE_GTK_DOC
|
|
|
|
SUBDIRS += \
|
2013-01-09 10:46:41 +01:00
|
|
|
Index: systemd-195/configure.ac
|
2012-04-20 17:46:37 +02:00
|
|
|
===================================================================
|
2013-01-09 10:46:41 +01:00
|
|
|
--- systemd-195.orig/configure.ac
|
|
|
|
+++ systemd-195/configure.ac
|
|
|
|
@@ -660,6 +660,13 @@ fi
|
2012-04-20 17:46:37 +02:00
|
|
|
with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
|
|
|
|
AC_DEFINE_UNQUOTED(DISTRIBUTION, ["${with_distro}"], [Target Distribution])
|
|
|
|
|
|
|
|
+if test z"$with_distro" = z"suse" ; then
|
|
|
|
+ AC_PATH_PROG([HWINFO], [hwinfo], [/usr/sbin/hwinfo], [/sbin:/usr/sbin:/usr/bin:/bin])
|
|
|
|
+ AC_DEFINE_UNQUOTED([HWINFO], ["${HWINFO}"], [Path to hwinfo binary. (SUSE)])
|
|
|
|
+fi
|
|
|
|
+AC_PATH_PROG([SETLEDS], [setleds], [/bin/setleds], [/sbin:/usr/sbin:/usr/bin:/bin])
|
2012-07-04 11:05:59 +02:00
|
|
|
+AC_DEFINE_UNQUOTED([SETLEDS], ["${SETLEDS}"], [Path to setleds binary.])
|
2012-04-20 17:46:37 +02:00
|
|
|
+
|
|
|
|
# Location of the init scripts as mandated by LSB
|
|
|
|
SYSTEM_SYSVINIT_PATH=/etc/init.d
|
|
|
|
SYSTEM_SYSVRCND_PATH=/etc/rc.d
|
2013-01-09 10:46:41 +01:00
|
|
|
Index: systemd-195/rules/73-seat-numlock.rules
|
2012-04-20 17:46:37 +02:00
|
|
|
===================================================================
|
|
|
|
--- /dev/null
|
2013-01-09 10:46:41 +01:00
|
|
|
+++ systemd-195/rules/73-seat-numlock.rules
|
2012-04-20 17:46:37 +02:00
|
|
|
@@ -0,0 +1,8 @@
|
|
|
|
+# This file is part of systemd.
|
|
|
|
+#
|
|
|
|
+# systemd is free software; you can redistribute it and/or modify it
|
|
|
|
+# under the terms of the GNU General Public License as published by
|
|
|
|
+# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
+# (at your option) any later version.
|
|
|
|
+
|
2012-07-04 11:05:59 +02:00
|
|
|
+SUBSYSTEM=="tty", ACTION=="add", KERNEL=="tty[0-9]|tty1[0-2]", TEST=="/run/numlock-on", RUN+="numlock-on $env{DEVNAME}"
|
2013-01-09 10:46:41 +01:00
|
|
|
Index: systemd-195/src/login/numlock-on.c
|
2012-07-04 11:05:59 +02:00
|
|
|
===================================================================
|
|
|
|
--- /dev/null
|
2013-01-09 10:46:41 +01:00
|
|
|
+++ systemd-195/src/login/numlock-on.c
|
2012-07-04 11:05:59 +02:00
|
|
|
@@ -0,0 +1,36 @@
|
|
|
|
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
|
|
|
+
|
|
|
|
+/***
|
|
|
|
+ This file is part of systemd.
|
|
|
|
+
|
|
|
|
+ Copyright 2012 Stanislav Brabec
|
|
|
|
+
|
|
|
|
+ systemd is free software; you can redistribute it and/or modify it
|
|
|
|
+ under the terms of the GNU General Public License as published by
|
|
|
|
+ the Free Software Foundation; either version 2 of the License, or
|
|
|
|
+ (at your option) any later version.
|
|
|
|
+
|
|
|
|
+ systemd is distributed in the hope that it will be useful, but
|
|
|
|
+ WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
+ General Public License for more details.
|
|
|
|
+
|
|
|
|
+ You should have received a copy of the GNU General Public License
|
|
|
|
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
+***/
|
|
|
|
+
|
|
|
|
+#include "config.h"
|
|
|
|
+#include <fcntl.h>
|
|
|
|
+#include <sysexits.h>
|
|
|
|
+#include <unistd.h>
|
|
|
|
+
|
|
|
|
+int main (int argc, char *argv[]) {
|
|
|
|
+ static char *args[] = { SETLEDS, "-D", "+num", NULL };
|
|
|
|
+
|
|
|
|
+ if (argc != 2)
|
|
|
|
+ return EX_USAGE;
|
|
|
|
+ close (STDIN_FILENO);
|
|
|
|
+ if (open (argv[1], O_RDONLY) != STDIN_FILENO)
|
|
|
|
+ return EX_IOERR;
|
|
|
|
+ return execv(args[0], args);
|
|
|
|
+}
|
2013-01-09 10:46:41 +01:00
|
|
|
Index: systemd-195/units/systemd-vconsole-setup.service.in
|
2012-07-21 22:32:38 +02:00
|
|
|
===================================================================
|
2013-01-09 10:46:41 +01:00
|
|
|
--- systemd-195.orig/units/systemd-vconsole-setup.service.in
|
|
|
|
+++ systemd-195/units/systemd-vconsole-setup.service.in
|
2012-10-26 14:34:44 +02:00
|
|
|
@@ -11,7 +11,7 @@ Documentation=man:systemd-vconsole-setup
|
2012-07-21 22:32:38 +02:00
|
|
|
DefaultDependencies=no
|
|
|
|
Conflicts=shutdown.target
|
|
|
|
After=systemd-readahead-collect.service systemd-readahead-replay.service
|
|
|
|
-Before=sysinit.target shutdown.target
|
|
|
|
+Before=sysinit.target shutdown.target udev-trigger.service
|
2012-10-26 14:34:44 +02:00
|
|
|
ConditionPathExists=/dev/tty0
|
2012-07-21 22:32:38 +02:00
|
|
|
|
|
|
|
[Service]
|