SHA256
1
0
forked from pool/kbd
kbd/kbd-1.14.1-dumpkeys-ppc.patch

70 lines
2.1 KiB
Diff
Raw Normal View History

XXX: this has been reverted upstream with the comment:
Revert "[SYSTEM] Apply patch from SUSE."
This is an old mistake. No, 0 is not a valid keycode.
It is used by the kernel for bookkeeping purposes.
It must not be used as keycode.
Andries
This reverts commit 49ce531d1c70017113540318b24b9d645d170773.
Signed-off-by: Andries Brouwer <Andries.Brouwer@cwi.nl>
Signed-off-by: Alexey Gladkov <legion@altlinux.org>
---
src/dumpkeys.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
--- kbd-1.14.1.orig/src/dumpkeys.c
+++ kbd-1.14.1/src/dumpkeys.c
@@ -166,6 +166,10 @@ valid_type(int t) {
ke.kb_index = 0;
ke.kb_table = 0;
ke.kb_value = K(t, 0);
+#if defined(__mc68000__) || defined(__powerpc__)
+ /* Keycode 0 is a valid keycode, do not clobber it. */
+ ioctl(fd, KDGKBENT, (unsigned long)&ke);
+#endif
status = (ioctl(fd, KDSKBENT, (unsigned long)&ke) == 0);
return status;
}
@@ -248,8 +252,13 @@ static void
show_short_info(void) {
int i;
+#if !defined(__mc68000__) && !defined(__powerpc__)
printf(_("keycode range supported by kernel: 1 - %d\n"),
nr_keys - 1);
+#else
+ printf(_("keycode range supported by kernel: 0 - %d\n"),
+ NR_KEYS - 1);
+#endif
printf(_("max number of actions bindable to a key: %d\n"),
MAX_NR_KEYMAPS);
get_keymaps();
@@ -361,7 +370,11 @@ dump_keys(char table_shape, char numeric
for (j = 0; j < MAX_NR_KEYMAPS; j++) {
int ja = (j | M_ALT);
if (j != ja && keymap_index[j] >= 0 && keymap_index[ja] >= 0)
+#if !defined(__mc68000__) && !defined(__powerpc__)
for (i = 1; i < nr_keys; i++) {
+#else
+ for (i = 0; i < nr_keys; i++) {
+#endif
int buf0, buf1, type;
buf0 = get_bind(i, j);
@@ -389,7 +402,11 @@ dump_keys(char table_shape, char numeric
not_alt_is_meta:
no_shorthands:
+#if !defined(__mc68000__) && !defined(__powerpc__)
for (i = 1; i < nr_keys; i++) {
+#else
+ for (i = 0; i < nr_keys; i++) {
+#endif
for (j = 0; j < keymapnr; j++)
buf[j] = get_bind(i, good_keymap[j]);
if (buf[0] == -1)