kbd-2.4.0

This commit is contained in:
Rmys
2021-06-12 18:01:08 +03:00
committed by GitHub
parent 934eff36e7
commit e9b9a42caa
13 changed files with 593 additions and 48 deletions
@@ -0,0 +1,52 @@
diff -up kbd-2.3.0/docs/man/man1/showkey.1.orig kbd-2.3.0/docs/man/man1/showkey.1
--- kbd-2.3.0/docs/man/man1/showkey.1.orig 2020-07-08 19:25:47.000000000 +0200
+++ kbd-2.3.0/docs/man/man1/showkey.1 2020-07-16 08:56:15.970254183 +0200
@@ -84,6 +84,19 @@ corresponds to what the keyboard hardwar
to know the scan codes sent by various keys it is better to boot a
2.4 kernel. Since 2.6.9 there also is the boot option atkbd.softraw=0
that tells the 2.6 kernel to return the actual scan codes.
+
+.SH NOTES
+The raw scan codes are available only on AT and PS/2 keyboards,
+and even then they are disabled unless the
+.B atkbd.softraw=0
+kernel parameter is used.
+When the raw scan codes are not available, the kernel uses a fixed built-in
+table to produce scan codes from keycodes. Thus,
+.BR setkeycodes (8)
+can affect the output of
+.B showkey
+in scan code dump mode.
+
.SH "SEE ALSO"
.BR loadkeys (1),
.BR dumpkeys (1),
diff -up kbd-2.3.0/docs/man/man8/setkeycodes.8.orig kbd-2.3.0/docs/man/man8/setkeycodes.8
--- kbd-2.3.0/docs/man/man8/setkeycodes.8.orig 2020-07-08 19:35:35.000000000 +0200
+++ kbd-2.3.0/docs/man/man8/setkeycodes.8 2020-07-16 08:57:52.293900997 +0200
@@ -42,6 +42,10 @@ the command
will assign the keycode 112 to it, and then
.BR loadkeys (1)
can be used to define the function of this key.
+
+USB keyboards have standardized keycodes and
+.B setkeycodes
+doesn't affect them at all.
.LP
Some older kernels might hardwire a low scancode range to the
equivalent keycodes; setkeycodes will fail when you try to remap
@@ -60,6 +64,14 @@ None.
.SH BUGS
The keycodes of X have nothing to do with those of Linux.
Unusual keys can be made visible under Linux, but not under X.
+
+.B setkeycodes
+affects only the "first" input device
+that has modifiable scancode-to-keycode mapping.
+If there is more than one such device,
+.B setkeycodes
+cannot change the mapping of other devices than the "first" one.
+
.SH "SEE ALSO"
.BR dumpkeys (1),
.BR loadkeys (1),
@@ -0,0 +1,62 @@
diff -up kbd-2.1.0/docs/man/man8/kbdrate.8.orig kbd-2.1.0/docs/man/man8/kbdrate.8
--- kbd-2.1.0/docs/man/man8/kbdrate.8.orig 2019-06-21 10:08:17.000000000 +0200
+++ kbd-2.1.0/docs/man/man8/kbdrate.8 2019-07-17 10:36:19.876499648 +0200
@@ -19,7 +19,7 @@ Using
without any options will reset the repeat rate to 10.9 characters per second (cps)
and the delay to 250 milliseconds (ms) for Intel- and M68K-based systems.
These are the IBM defaults. On SPARC-based systems it will reset the repeat rate
-to 5 cps and the delay to 200 ms.
+to 20 cps and the delay to 200 ms.
.SH OPTIONS
.TP
diff -up kbd-2.1.0/src/kbdrate.c.orig kbd-2.1.0/src/kbdrate.c
--- kbd-2.1.0/src/kbdrate.c.orig 2019-07-02 17:44:57.000000000 +0200
+++ kbd-2.1.0/src/kbdrate.c 2019-07-17 11:07:04.732486323 +0200
@@ -114,9 +114,12 @@ static int print_only = 0;
static int
KDKBDREP_ioctl_ok(double rate, int delay, int silent)
{
+#if defined(KDKBDREP) && !defined(__sparc__)
/*
* This ioctl is defined in <linux/kd.h> but is not
* implemented anywhere - must be in some m68k patches.
+ * We cannot blindly try unimplemented ioctls on sparc64 -
+ * the 32<->64bit transition layer does not like it.
* Since 2.4.9 also on i386.
*/
struct my_kbd_repeat kbdrep_s;
@@ -181,6 +184,9 @@ KDKBDREP_ioctl_ok(double rate, int delay
}
return 1; /* success! */
+#else /* no KDKBDREP or __sparc__ */
+ return 0;
+#endif /* KDKBDREP */
}
#ifdef KIOCSRATE
@@ -251,6 +257,9 @@ ioport_set(double rate, int delay, int s
/* https://wiki.osdev.org/PS/2_Keyboard */
+ /* The ioport way - will crash on sparc */
+
+#ifndef __sparc__
for (i = 0; i < (int) RATE_COUNT; i++)
if (rate * 10 >= valid_rates[i]) {
value &= 0x60;
@@ -304,11 +313,12 @@ ioport_set(double rate, int delay, int s
valid_rates[value & 0x1f] / 10.0,
valid_delays[(value & 0x60) >> 5]);
+#endif
return 1;
}
#ifdef __sparc__
-double rate = 5.0; /* Default rate */
+double rate = 20.0; /* Default rate */
int delay = 200; /* Default delay */
#else
double rate = 10.9; /* Default rate */
@@ -0,0 +1,21 @@
diff -up kbd-1.15.2/src/unicode_start.orig kbd-1.15.2/src/unicode_start
--- kbd-1.15.2/src/unicode_start.orig 2011-01-05 13:28:22.079662644 +0100
+++ kbd-1.15.2/src/unicode_start 2011-01-05 13:29:01.327353698 +0100
@@ -72,6 +72,9 @@ stty iutf8
# have a Unicode map attached, or explicitly specified, e.g.,
# by giving `def.uni' as a second argument.
+DEFAULT_UNICODE_FONT=latarcyrheb-sun16
+# Also drdos8x16 is a good candidate.
+
case "$#" in
2)
setfont "$1" -u "$2"
@@ -80,6 +83,7 @@ case "$#" in
setfont "$1"
;;
0)
+ setfont $DEFAULT_UNICODE_FONT
;;
*)
echo "usage: unicode_start [font [unicode map]]"
@@ -0,0 +1,18 @@
diff -up kbd-2.0.4/docs/man/man1/dumpkeys.1.in.orig kbd-2.0.4/docs/man/man1/dumpkeys.1.in
--- kbd-2.0.4/docs/man/man1/dumpkeys.1.in.orig 2017-01-11 11:12:22.884029413 +0100
+++ kbd-2.0.4/docs/man/man1/dumpkeys.1.in 2017-01-11 11:12:47.537040194 +0100
@@ -164,6 +164,14 @@ output of
.BI \-S shape " " " " \-\-shape= shape
.LP
.TP
+.B \-1 \-\-separate-lines
+This forces
+.B dumpkeys
+to write one line per (modifier,keycode) pair. It prefixes the word
+.I plain
+for plain keycodes.
+.LP
+.TP
.B \-t \-\-funcs-only
When this option is given,
.B dumpkeys
@@ -0,0 +1,24 @@
diff -up kbd-2.3.0/src/loadkeys.c.orig kbd-2.3.0/src/loadkeys.c
--- kbd-2.3.0/src/loadkeys.c.orig 2020-06-02 12:16:45.000000000 +0200
+++ kbd-2.3.0/src/loadkeys.c 2020-07-16 09:02:50.398864688 +0200
@@ -28,6 +28,8 @@
static const char *const dirpath1[] = {
"",
DATADIR "/" KEYMAPDIR "/**",
+ DATADIR "/" XKBKEYMAPDIR "/",
+ DATADIR "/" LEGACYKEYMAPDIR "/**",
KERNDIR "/",
NULL
};
diff -up kbd-2.3.0/src/paths.h.orig kbd-2.3.0/src/paths.h
--- kbd-2.3.0/src/paths.h.orig 2020-07-16 09:02:59.243010909 +0200
+++ kbd-2.3.0/src/paths.h 2020-07-16 09:03:23.446410942 +0200
@@ -5,6 +5,8 @@
* The following five subdirectories are defined:
*/
#define KEYMAPDIR "keymaps"
+#define XKBKEYMAPDIR "keymaps/xkb"
+#define LEGACYKEYMAPDIR "keymaps/legacy"
#define UNIMAPDIR "unimaps"
#define TRANSDIR "consoletrans"
#define VIDEOMODEDIR "videomodes"
@@ -0,0 +1,12 @@
diff -up kbd-1.15.5/data/keymaps/i386/qwertz/sg.map.orig kbd-1.15.5/data/keymaps/i386/qwertz/sg.map
--- kbd-1.15.5/data/keymaps/i386/qwertz/sg.map.orig 2013-02-21 15:54:39.362799094 +0100
+++ kbd-1.15.5/data/keymaps/i386/qwertz/sg.map 2013-02-21 15:54:46.448838554 +0100
@@ -1,7 +1,7 @@
keymaps 0-2,4-6,8,12
include "qwertz-layout"
include "linux-with-alt-and-altgr.inc"
- plain keycode 83 = KP_Comma
+ plain keycode 83 = KP_Period
strings as usual
keycode 1 = Escape Escape
@@ -0,0 +1,61 @@
--- a/src/vlock/auth.c
+++ b/src/vlock/auth.c
@@ -4,7 +4,7 @@
PAM authentication routine for vlock, the VT locking program for linux.
Copyright (C) 1994-1998 Michael K. Johnson <johnsonm@redhat.com>
- Copyright (C) 2002, 2005 Dmitry V. Levin <ldv@altlinux.org>
+ Copyright (C) 2002, 2005, 2013 Dmitry V. Levin <ldv@altlinux.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -36,6 +36,25 @@
/* Unrecognized PAM error timeout. */
#define ERROR_TIMEOUT 10
+static int
+do_account_password_management (pam_handle_t *pamh)
+{
+ int rc;
+
+ /* Whether the authenticated user is allowed to log in? */
+ rc = pam_acct_mgmt (pamh, 0);
+
+ /* Do we need to prompt the user for a new password? */
+ if (rc == PAM_NEW_AUTHTOK_REQD)
+ rc = pam_chauthtok (pamh, PAM_CHANGE_EXPIRED_AUTHTOK);
+
+ /* Extend the lifetime of the existing credentials. */
+ if (rc == PAM_SUCCESS)
+ rc = pam_setcred (pamh, PAM_REFRESH_CRED);
+
+ return rc;
+}
+
int
get_password (pam_handle_t * pamh, const char *username, const char *tty)
{
@@ -84,6 +103,23 @@ get_password (pam_handle_t * pamh, const char *username, const char *tty)
switch (rc)
{
case PAM_SUCCESS:
+ rc = do_account_password_management (pamh);
+
+ if (rc != PAM_SUCCESS)
+ {
+ /*
+ * The user was authenticated but
+ * either account or password management
+ * returned an error.
+ */
+ printf ("%s.\n\n\n",
+ pam_strerror (pamh, rc));
+ fflush (stdout);
+ pam_end (pamh, rc);
+ pamh = 0;
+ break;
+ }
+
pam_end (pamh, rc);
/* Log the fact of console unlocking. */
syslog (LOG_NOTICE,
@@ -0,0 +1,15 @@
diff -up kbd-2.0.2/src/unicode_start.orig kbd-2.0.2/src/unicode_start
--- kbd-2.0.2/src/unicode_start.orig 2014-08-12 14:47:53.019028849 +0200
+++ kbd-2.0.2/src/unicode_start 2014-08-12 14:54:42.631427602 +0200
@@ -72,7 +72,10 @@ stty iutf8
# have a Unicode map attached, or explicitly specified, e.g.,
# by giving `def.uni' as a second argument.
-DEFAULT_UNICODE_FONT=latarcyrheb-sun16
+# Source /etc/vconsole.conf to get default font
+. /etc/vconsole.conf
+
+DEFAULT_UNICODE_FONT=$FONT
# Also drdos8x16 is a good candidate.
case "$#" in
@@ -0,0 +1,11 @@
diff -up kbd-2.3.0/src/libkfont/kdmapop.c.orig kbd-2.3.0/src/libkfont/kdmapop.c
--- kbd-2.3.0/src/libkfont/kdmapop.c.orig 2020-04-27 17:53:01.000000000 +0200
+++ kbd-2.3.0/src/libkfont/kdmapop.c 2020-07-16 09:06:45.246742724 +0200
@@ -166,6 +166,7 @@ kfont_get_unicodemap(struct kfont_contex
if (ioctl(fd, GIO_UNIMAP, &ud)) {
KFONT_ERR(ctx, "ioctl(GIO_UNIMAP): %m");
+ free(ud.entries);
return -1;
}
if (ct != ud.entry_ct)