Sync from SUSE:SLFO:Main kbd revision 6b424ac7988a8f1f47764622e2f0e359

This commit is contained in:
Adrian Schröter 2024-05-03 14:10:00 +02:00
commit af74622818
31 changed files with 4347 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

42
README.SUSE Normal file
View File

@ -0,0 +1,42 @@
Handling of composition of characters
=====================================
Most of the fonts have much more characters than you can reach directly
through the keyboard. To access all of them you may use showconsolefont,
deduce the decimal code and enter it by holding down <alt> and entering
the code via the keypad. There's a much better way, though:
Most characters may be entered via composition. Many characters are just
consisting of a standard character with some sort of accent or change.
Such characters can be composed by composition. Just press the <compose>
key, let it go again, enter the accent and then the letter.
Some examples: (Assuming Iso-Latin-1/9 character set:)
<compose> " a => ä
<compose> , c => ç
<compose> | S => $
Support for composition is unfortunately not contained in most keymaps.
Most lack two things:
(a) The <compose> key is not mapped
(b) The compose tables are not included
Look at the compose.* files in /usr/share/kbd/keymaps/include/:
(a) You find there two files for having the <compose> key mapped.
(b) You find there compose tables which are suitable for different
character sets.
ad (a): winkeys: The compose key will be mapped on the W*n menu key
shiftctrl: The compose key will be mapped to Shift Ctrl.
You can use both, if you like.
ad (b): latin, latinX, latin1.add, 8859_X: Contains the compose
combinations suitable for the respective character set.
Many people will want to use latin1 or latin1.add. Just
using latin is also sort of an acceptable compromise for
many Latin character sets.
YOU MAY ONLY USE ONE OF THOSE.
If you want the combination of more than one table, you
have to create a file which includes what you want.
Please keep in mind, that all these settings only affect the console,
i.e. text mode.
Your SuSE team

99
autogen.sh Normal file
View File

@ -0,0 +1,99 @@
#!/bin/sh -efu
OPT=
[ "${1-}" != '-f' ] || OPT=--force
fatal()
{
printf >&2 '%s\n' "$*"
exit 1
}
setvars()
{
local varname="$1"; shift
eval "prog_$varname=\"\$1\""; shift
eval "version_matcher_$varname=\"\$1\""; shift
eval "version_pattern_$varname=\"\$1\""; shift
eval "args_$varname=\"\$@\""
}
getvars()
{
eval "prog=\"\$prog_$1\""
eval "version_matcher=\"\${version_matcher_$1:-gnu_version_matcher}\""
eval "version_pattern=\"\$version_pattern_$1\""
eval "args=\"\$args_$1\""
}
get_version()
{
"$prog" --version </dev/null 2>/dev/null | head -1 | "$version_matcher"
}
gnu_version_matcher()
{
sed -n -e 's/^.* \([0-9]\+\(\.[0-9]\+\)*\)$/\1/p'
}
vars=
register()
{
setvars "$@"
vars="$vars $1"
}
foreach()
{
local varname
for varname in $vars; do
getvars "$varname"
"$@"
done
}
check_program()
{
which "$prog" >/dev/null 2>&1 ||
fatal "ERROR: You must have $varname installed to build the kbd."
if [ -n "$version_pattern" ]; then
local version="$(get_version "$varname")"
[ -n "${version##$version_pattern}" ] ||
return 0
fatal "You must have $varname version >= $version_pattern, but you have $version ."
fi
}
show_version()
{
printf ' %10s: version ' "$prog"
get_version "$varname"
}
execute()
{
eval "set -- \$args_$varname"
printf 'RUN: %s\n' "$prog $*"
"$prog" "$@" || exit 1
}
register autopoint "${AUTOPOINT:-autopoint}" '' '' $OPT -f
register libtoolize "${LIBTOOLIZE:-libtoolize}" '' '' $OPT --install --copy --automake
register aclocal "${ACLOCAL:-aclocal}" '' '' $OPT -I m4
register autoconf "${AUTOCONF:-autoconf}" '' '' $OPT -I m4
register autoheader "${AUTOHEADER:-autoheader}" '' '' $OPT -I m4
register automake "${AUTOMAKE:-automake}" '' '' --force-missing --add-missing --copy
printf '\n%s' 'Checking build-system utilities: '
foreach check_program
printf 'OK\n'
printf '\n%s\n' 'Generating build-system with:'
foreach show_version
printf '\n'
rm -rf autom4te.cache
foreach execute
printf '\n%s\n\n' "Now type '${0%/*}/configure' and 'make' to compile."

102
convert-kbd-mac.sed Normal file
View File

@ -0,0 +1,102 @@
# vim: syntax=sed
s#keycode[[:blank:]]*122[[:blank:]]*=[[:blank:]]*#keycode 59 = #;t 1;
s#keycode[[:blank:]]*121[[:blank:]]*=[[:blank:]]*#keycode 109 = #;t 1;
s#keycode[[:blank:]]*120[[:blank:]]*=[[:blank:]]*#keycode 60 = #;t 1;
s#keycode[[:blank:]]*119[[:blank:]]*=[[:blank:]]*#keycode 107 = #;t 1;
s#keycode[[:blank:]]*118[[:blank:]]*=[[:blank:]]*#keycode 62 = #;t 1;
s#keycode[[:blank:]]*117[[:blank:]]*=[[:blank:]]*#keycode 111 = #;t 1;
s#keycode[[:blank:]]*116[[:blank:]]*=[[:blank:]]*#keycode 104 = #;t 1;
s#keycode[[:blank:]]*115[[:blank:]]*=[[:blank:]]*#keycode 102 = #;t 1;
s#keycode[[:blank:]]*114[[:blank:]]*=[[:blank:]]*#keycode 110 = #;t 1;
s#keycode[[:blank:]]*113[[:blank:]]*=[[:blank:]]*#keycode 101 = #;t 1;
s#keycode[[:blank:]]*111[[:blank:]]*=[[:blank:]]*#keycode 88 = #;t 1;
s#keycode[[:blank:]]*109[[:blank:]]*=[[:blank:]]*#keycode 68 = #;t 1;
s#keycode[[:blank:]]*107[[:blank:]]*=[[:blank:]]*#keycode 70 = #;t 1;
s#keycode[[:blank:]]*103[[:blank:]]*=[[:blank:]]*#keycode 87 = #;t 1;
s#keycode[[:blank:]]*101[[:blank:]]*=[[:blank:]]*#keycode 67 = #;t 1;
s#keycode[[:blank:]]*100[[:blank:]]*=[[:blank:]]*#keycode 66 = #;t 1;
s#keycode[[:blank:]]*99[[:blank:]]*=[[:blank:]]*#keycode 61 = #;t 1;
s#keycode[[:blank:]]*98[[:blank:]]*=[[:blank:]]*#keycode 65 = #;t 1;
s#keycode[[:blank:]]*97[[:blank:]]*=[[:blank:]]*#keycode 64 = #;t 1;
s#keycode[[:blank:]]*96[[:blank:]]*=[[:blank:]]*#keycode 63 = #;t 1;
s#keycode[[:blank:]]*92[[:blank:]]*=[[:blank:]]*#keycode 73 = #;t 1;
s#keycode[[:blank:]]*91[[:blank:]]*=[[:blank:]]*#keycode 72 = #;t 1;
s#keycode[[:blank:]]*89[[:blank:]]*=[[:blank:]]*#keycode 71 = #;t 1;
s#keycode[[:blank:]]*88[[:blank:]]*=[[:blank:]]*#keycode 77 = #;t 1;
s#keycode[[:blank:]]*87[[:blank:]]*=[[:blank:]]*#keycode 76 = #;t 1;
s#keycode[[:blank:]]*86[[:blank:]]*=[[:blank:]]*#keycode 75 = #;t 1;
s#keycode[[:blank:]]*85[[:blank:]]*=[[:blank:]]*#keycode 81 = #;t 1;
s#keycode[[:blank:]]*84[[:blank:]]*=[[:blank:]]*#keycode 80 = #;t 1;
s#keycode[[:blank:]]*83[[:blank:]]*=[[:blank:]]*#keycode 79 = #;t 1;
s#keycode[[:blank:]]*82[[:blank:]]*=[[:blank:]]*#keycode 82 = #;t 1;
s#keycode[[:blank:]]*81[[:blank:]]*=[[:blank:]]*#keycode 117 = #;t 1;
s#keycode[[:blank:]]*78[[:blank:]]*=[[:blank:]]*#keycode 74 = #;t 1;
s#keycode[[:blank:]]*76[[:blank:]]*=[[:blank:]]*#keycode 96 = #;t 1;
s#keycode[[:blank:]]*75[[:blank:]]*=[[:blank:]]*#keycode 98 = #;t 1;
s#keycode[[:blank:]]*71[[:blank:]]*=[[:blank:]]*#keycode 69 = #;t 1;
s#keycode[[:blank:]]*69[[:blank:]]*=[[:blank:]]*#keycode 78 = #;t 1;
s#keycode[[:blank:]]*67[[:blank:]]*=[[:blank:]]*#keycode 55 = #;t 1;
s#keycode[[:blank:]]*65[[:blank:]]*=[[:blank:]]*#keycode 83 = #;t 1;
s#keycode[[:blank:]]*62[[:blank:]]*=[[:blank:]]*#keycode 103 = #;t 1;
s#keycode[[:blank:]]*61[[:blank:]]*=[[:blank:]]*#keycode 108 = #;t 1;
s#keycode[[:blank:]]*60[[:blank:]]*=[[:blank:]]*#keycode 106 = #;t 1;
s#keycode[[:blank:]]*59[[:blank:]]*=[[:blank:]]*#keycode 105 = #;t 1;
s#keycode[[:blank:]]*58[[:blank:]]*=[[:blank:]]*#keycode 56 = #;t 1;
s#keycode[[:blank:]]*57[[:blank:]]*=[[:blank:]]*#keycode 58 = #;t 1;
s#keycode[[:blank:]]*56[[:blank:]]*=[[:blank:]]*#keycode 42 = #;t 1;
s#keycode[[:blank:]]*55[[:blank:]]*=[[:blank:]]*#keycode 125 = #;t 1;
s#keycode[[:blank:]]*54[[:blank:]]*=[[:blank:]]*#keycode 29 = #;t 1;
s#keycode[[:blank:]]*53[[:blank:]]*=[[:blank:]]*#keycode 1 = #;t 1;
s#keycode[[:blank:]]*51[[:blank:]]*=[[:blank:]]*#keycode 14 = #;t 1;
s#keycode[[:blank:]]*50[[:blank:]]*=[[:blank:]]*#keycode 41 = #;t 1;
s#keycode[[:blank:]]*49[[:blank:]]*=[[:blank:]]*#keycode 57 = #;t 1;
s#keycode[[:blank:]]*48[[:blank:]]*=[[:blank:]]*#keycode 15 = #;t 1;
s#keycode[[:blank:]]*47[[:blank:]]*=[[:blank:]]*#keycode 52 = #;t 1;
s#keycode[[:blank:]]*46[[:blank:]]*=[[:blank:]]*#keycode 50 = #;t 1;
s#keycode[[:blank:]]*45[[:blank:]]*=[[:blank:]]*#keycode 49 = #;t 1;
s#keycode[[:blank:]]*44[[:blank:]]*=[[:blank:]]*#keycode 53 = #;t 1;
s#keycode[[:blank:]]*43[[:blank:]]*=[[:blank:]]*#keycode 51 = #;t 1;
s#keycode[[:blank:]]*42[[:blank:]]*=[[:blank:]]*#keycode 43 = #;t 1;
s#keycode[[:blank:]]*41[[:blank:]]*=[[:blank:]]*#keycode 39 = #;t 1;
s#keycode[[:blank:]]*40[[:blank:]]*=[[:blank:]]*#keycode 37 = #;t 1;
s#keycode[[:blank:]]*39[[:blank:]]*=[[:blank:]]*#keycode 40 = #;t 1;
s#keycode[[:blank:]]*38[[:blank:]]*=[[:blank:]]*#keycode 36 = #;t 1;
s#keycode[[:blank:]]*37[[:blank:]]*=[[:blank:]]*#keycode 38 = #;t 1;
s#keycode[[:blank:]]*36[[:blank:]]*=[[:blank:]]*#keycode 28 = #;t 1;
s#keycode[[:blank:]]*35[[:blank:]]*=[[:blank:]]*#keycode 25 = #;t 1;
s#keycode[[:blank:]]*34[[:blank:]]*=[[:blank:]]*#keycode 23 = #;t 1;
s#keycode[[:blank:]]*33[[:blank:]]*=[[:blank:]]*#keycode 26 = #;t 1;
s#keycode[[:blank:]]*32[[:blank:]]*=[[:blank:]]*#keycode 22 = #;t 1;
s#keycode[[:blank:]]*31[[:blank:]]*=[[:blank:]]*#keycode 24 = #;t 1;
s#keycode[[:blank:]]*30[[:blank:]]*=[[:blank:]]*#keycode 27 = #;t 1;
s#keycode[[:blank:]]*29[[:blank:]]*=[[:blank:]]*#keycode 11 = #;t 1;
s#keycode[[:blank:]]*28[[:blank:]]*=[[:blank:]]*#keycode 9 = #;t 1;
s#keycode[[:blank:]]*27[[:blank:]]*=[[:blank:]]*#keycode 12 = #;t 1;
s#keycode[[:blank:]]*26[[:blank:]]*=[[:blank:]]*#keycode 8 = #;t 1;
s#keycode[[:blank:]]*25[[:blank:]]*=[[:blank:]]*#keycode 10 = #;t 1;
s#keycode[[:blank:]]*24[[:blank:]]*=[[:blank:]]*#keycode 13 = #;t 1;
s#keycode[[:blank:]]*23[[:blank:]]*=[[:blank:]]*#keycode 6 = #;t 1;
s#keycode[[:blank:]]*22[[:blank:]]*=[[:blank:]]*#keycode 7 = #;t 1;
s#keycode[[:blank:]]*21[[:blank:]]*=[[:blank:]]*#keycode 5 = #;t 1;
s#keycode[[:blank:]]*20[[:blank:]]*=[[:blank:]]*#keycode 4 = #;t 1;
s#keycode[[:blank:]]*19[[:blank:]]*=[[:blank:]]*#keycode 3 = #;t 1;
s#keycode[[:blank:]]*18[[:blank:]]*=[[:blank:]]*#keycode 2 = #;t 1;
s#keycode[[:blank:]]*17[[:blank:]]*=[[:blank:]]*#keycode 20 = #;t 1;
s#keycode[[:blank:]]*16[[:blank:]]*=[[:blank:]]*#keycode 21 = #;t 1;
s#keycode[[:blank:]]*15[[:blank:]]*=[[:blank:]]*#keycode 19 = #;t 1;
s#keycode[[:blank:]]*14[[:blank:]]*=[[:blank:]]*#keycode 18 = #;t 1;
s#keycode[[:blank:]]*13[[:blank:]]*=[[:blank:]]*#keycode 17 = #;t 1;
s#keycode[[:blank:]]*12[[:blank:]]*=[[:blank:]]*#keycode 16 = #;t 1;
s#keycode[[:blank:]]*11[[:blank:]]*=[[:blank:]]*#keycode 48 = #;t 1;
s#keycode[[:blank:]]*10[[:blank:]]*=[[:blank:]]*#keycode 86 = #;t 1;
s#keycode[[:blank:]]*9[[:blank:]]*=[[:blank:]]*#keycode 47 = #;t 1;
s#keycode[[:blank:]]*8[[:blank:]]*=[[:blank:]]*#keycode 46 = #;t 1;
s#keycode[[:blank:]]*7[[:blank:]]*=[[:blank:]]*#keycode 45 = #;t 1;
s#keycode[[:blank:]]*6[[:blank:]]*=[[:blank:]]*#keycode 44 = #;t 1;
s#keycode[[:blank:]]*5[[:blank:]]*=[[:blank:]]*#keycode 34 = #;t 1;
s#keycode[[:blank:]]*4[[:blank:]]*=[[:blank:]]*#keycode 35 = #;t 1;
s#keycode[[:blank:]]*3[[:blank:]]*=[[:blank:]]*#keycode 33 = #;t 1;
s#keycode[[:blank:]]*2[[:blank:]]*=[[:blank:]]*#keycode 32 = #;t 1;
s#keycode[[:blank:]]*1[[:blank:]]*=[[:blank:]]*#keycode 31 = #;t 1;
s#keycode[[:blank:]]*0[[:blank:]]*=[[:blank:]]*#keycode 30 = #;t 1;
:1;

52
cz-map.patch Normal file
View File

@ -0,0 +1,52 @@
--- cz.map.orig 2021-10-04 21:08:13.000000000 +0200
+++ cz.map 2021-10-04 21:13:29.969027000 +0200
@@ -108,3 +108,49 @@
keycode 127 = VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol
keycode 121 = KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period
strings as usual
+# dead_grave
+compose '`' 'u' to U+016F
+compose '`' 'U' to U+016E
+compose '`' 'z' to U+00B0
+compose '`' 'Z' to U+00B0
+# dead_acute
+compose '\'' 'a' to U+00E1
+compose '\'' 'A' to U+00C1
+compose '\'' 'e' to U+00E9
+compose '\'' 'E' to U+00C9
+compose '\'' 'i' to U+00ED
+compose '\'' 'I' to U+00CD
+compose '\'' 'o' to U+00F3
+compose '\'' 'O' to U+00D3
+compose '\'' 'u' to U+00FA
+compose '\'' 'U' to U+00DA
+compose '\'' 'y' to U+00FD
+compose '\'' 'Y' to U+00DD
+# dead_caron
+compose '^' 'u' to U+016F
+compose '^' 'U' to U+016E
+compose '^' 'c' to U+010D
+compose '^' 'C' to U+010C
+compose '^' 'd' to U+010F
+compose '^' 'D' to U+010E
+compose '^' 'e' to U+011B
+compose '^' 'E' to U+011A
+compose '^' 'n' to U+0148
+compose '^' 'N' to U+0147
+compose '^' 'r' to U+0159
+compose '^' 'R' to U+0158
+compose '^' 's' to U+0161
+compose '^' 'S' to U+0160
+compose '^' 't' to U+0165
+compose '^' 'T' to U+0164
+compose '^' 'z' to U+017E
+compose '^' 'Z' to U+017D
+# dead_diaeresis
+compose '"' 'a' to U+00E4
+compose '"' 'A' to U+00C4
+compose '"' 'e' to U+00EB
+compose '"' 'E' to U+00CB
+compose '"' 'o' to U+00F6
+compose '"' 'O' to U+00D6
+compose '"' 'u' to U+00FC
+compose '"' 'U' to U+00DC

49
fbtest.8 Normal file
View File

@ -0,0 +1,49 @@
'\" -*- coding: UTF-8 -*-
.\"
.\" Copyright 2008 Werner Fink, 2008 SUSE LINUX Products GmbH, Germany.
.\"
.\" 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
.\" the Free Software Foundation; either version 2 of the License, or
.\" (at your option) any later version.
.\"
.TH FBTEST 8 "May 6, 2008" "0.42" "International Support"
.SH NAME
fbtest \- test if a virtual console is mapped to a frame buffer devive
.SH SYNOPSIS
.B fbtest
.RB [ \-f \ \fI<fb_device>\fR]
.RB [ \-C \ \fI<vc_device>\fR]
.br
.B fbtest
.B \-\-help
.SH DESCRIPTION
The program
.BR fbtest (8)
is used to test if a virtual console, e.g.
.I /dev/tty1
is mapped on a frame buffer device.
.SH OPTIONS
.TP
.BR \-f ,\ \-\-fb = \fI<fb_device>\fR
This option specifies an other frame buffer device than
the default
.IR /dev/fb0 .
.TP
.BR \-C ,\ \-\-vc = \fI<vc_device>\fR
This option specifies an other virtual console than the default
.IR /dev/tty1 .
.SH EXIT STATUS
.IP \fB0\fR 5
The virtual console is mapped onto a frame buffer device.
.IP \fB1\fR 5
The virtual console is
.B not
mapped onto a frame buffer device.
.PP
.SH FILES
.I /dev/fb0
.br
.I /dev/tty<1...63>
.SH SEE ALSO
.BR fbset (8).

112
fbtest.c Normal file
View File

@ -0,0 +1,112 @@
/*
* fbtest(.c)
*
* Copyright 2008 Werner Fink, 2008 SUSE LINUX Products GmbH, Germany.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/sysmacros.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <unistd.h>
#include <linux/fb.h>
static struct option options[] = {
{ "fb", required_argument, 0, 'f'},
{ "vc", required_argument, 0, 'C'},
{ "help", no_argument, 0, 'h'},
{ (const char*)0, 0, (int*)0, 0}
};
int main(int argc, char * argv[])
{
struct fb_con2fbmap map = {1, -1};
const char *base = basename(argv[0]);
const char * fb = (char*)0;
const char * vc = (char*)0;
struct stat st;
int c, fd;
opterr = 0;
while ((c = getopt_long(argc, argv, "hf:C:", options, (int *)0)) != -1) {
switch (c) {
case 'f':
fb = optarg;
break;
case 'C':
vc = optarg;
break;
case 'h':
fprintf(stderr, "%s: Usage:\n %s [-f <fb_device>] [-C <vc_device>]\n", base, base);
fprintf(stderr, "Valid options are:\n");
fprintf(stderr, " -f <fb_device> The frame buffer device (default /dev/fb0)\n");
fprintf(stderr, " -C <vc_device> The virtual console device (default /dev/tty1)\n");
return 0;
case '?':
fprintf(stdout, "%s: Invalid option for help use:\n %s --help\n", base, base);
return 1;
break;
default:
break;
}
}
if (fb == (char*)0) {
fb = "/dev/fb/0";
if (stat(fb, &st) < 0) {
if (errno != ENOENT && errno != ENOTDIR) {
fprintf(stderr, "%s: %s: %m\n", base, fb);
return 1;
}
fb = "/dev/fb0";
if (stat(fb, &st) < 0) {
fprintf(stderr, "%s: %s: %m\n", base, fb);
return 1;
}
}
}
if (vc == (char*)0)
vc = "/dev/tty1";
if (stat(vc, &st) < 0) {
fprintf(stderr, "%s: %s: %m\n", base, vc);
return 1;
}
if (major(st.st_rdev) != (dev_t)4) {
errno = ECANCELED;
fprintf(stderr, "%s: %s: %m\n", base, vc);
return 1;
}
if ((fd = open(fb, O_RDONLY|O_NOCTTY)) < 0) {
if (errno != ENODEV)
fprintf(stderr, "%s: %s: %m\n", base, fb);
return 1;
}
map.console = (typeof(map.console))minor(st.st_rdev);
map.framebuffer = (typeof(map.framebuffer))-1;
if (ioctl(fd, FBIOGET_CON2FBMAP, &map) < 0) {
fprintf(stderr, "%s: %s: %m\n", base, fb);
return 1;
}
return map.framebuffer > FB_MAX;
}

70
genmap4systemd.sh Normal file
View File

@ -0,0 +1,70 @@
#!/bin/bash
# Generate entries for systemd's /usr/share/systemd/kbd-model-map
if [ $# -eq 0 ]; then
pushd /usr/share/kbd/keymaps/xkb > /dev/null || exit 1
else
pushd > /dev/null $1 || exit 1
fi
echo "# generated from xkb generated keymaps (basic layouts *without* variant)"
for i in $(ls *.map.gz|grep -v "-"); do
consolelayout=$(echo $i|sed 's/.map.gz//g')
layout=$consolelayout
variant="-"
printf '%s' "$consolelayout"
printf "\t\t\t"
printf '%s' "$layout"
printf '\t'
printf 'microsoftpro\t\t'
printf '%s' "$variant"
printf '\t\t'
printf 'terminate:ctrl_alt_bksp\n'
done | sort -u
echo "# generated from xkb generated keymaps (layouts *with* variant)"
for i in $(ls *-*.map.gz); do
consolelayout=$(echo $i|sed 's/.map.gz//g')
conlen=$(echo "$consolelayout" |wc -m)
conlen=$((conlen - 1))
layout=$(echo $i|cut -d "-" -f 1)
variant=$(echo $i|cut -d "-" -f 2,3,4,5,6,7,8,9,10|cut -d "." -f1)
varlen=$(echo $variant|wc -m)
varlen=$((varlen -1))
printf '%s' "$consolelayout"
if [ $conlen -lt 8 ]; then
printf "\t\t\t"
elif [ $conlen -lt 16 ]; then
printf "\t\t"
elif [ $conlen -lt 24 ]; then
printf "\t"
else
printf ' '
fi
printf '%s' "$layout"
printf '\t'
if [ "$layout" == "br" ]; then
printf 'abnt2\t\t'
elif [ "$layout" == "jp" ]; then
printf 'jp106\t\t'
else
printf 'microsoftpro\t\t'
fi
printf '%s' "$variant"
if [ $varlen -lt 8 ]; then
printf "\t\t"
elif [ $varlen -lt 16 ]; then
printf "\t"
else
printf ' '
fi
printf 'terminate:ctrl_alt_bksp\n'
done | sort -u
popd > /dev/null

View File

@ -0,0 +1,33 @@
--- a/docs/doc/kbd.FAQ-15.html.orig 2012-02-27 13:27:11.000000000 +0300
+++ b/docs/doc/kbd.FAQ-15.html 2013-07-30 18:56:43.697000005 +0300
@@ -188,7 +188,7 @@
<P>XFree86 also supports Slow Keys, Repeat Keys, Bounce Keys and an
audible bell. <CODE>xkbcomp</CODE> can be used to generate a <CODE>.xkm</CODE> file
to enable these. The appropriate <CODE>xkbcomp</CODE> commands are listed in
-<CODE>/usr/X11R6/lib/X11/xkb/compat/accessx</CODE>.
+<CODE>/usr/{X11R6/lib,share}/X11/xkb/compat/accessx</CODE>.
Unfortunately, the exact process is still undocumented.
<P>
<HR>
--- a/docs/doc/kbd.FAQ.txt.orig 2012-02-27 13:27:11.000000000 +0300
+++ b/docs/doc/kbd.FAQ.txt 2013-07-30 18:57:41.150000005 +0300
@@ -1253,7 +1253,7 @@
1. The Linux keyboard driver mechanism, used in conjunction with
loadkeys.
2. The X mechanism - see X386keybd(1), later XFree86kbd(1). Under
- X11R6: edit /usr/X11R6/lib/X11/locale/iso8859-1/Compose.
+ X11R6: edit /usr/{X11R6/lib,/usr/share}/X11/locale/iso8859-1/Compose.
See also Andrew D. Balsa's comments at
http://wauug.erols.com/~balsa/linux/deadkeys/index.html.
--- a/docs/doc/kbd.FAQ-8.html.orig 2012-02-27 13:27:11.000000000 +0300
+++ b/docs/doc/kbd.FAQ-8.html 2013-07-30 18:58:23.978000004 +0300
@@ -154,7 +154,7 @@
<OL>
<LI>The Linux keyboard driver mechanism, used in conjunction with loadkeys.</LI>
<LI>The X mechanism - see X386keybd(1), later XFree86kbd(1).
-Under X11R6: edit <CODE>/usr/X11R6/lib/X11/locale/iso8859-1/Compose</CODE>.<P>See also Andrew D. Balsa's comments at
+Under X11R6: edit <CODE>/usr/{X11R6/lib,share}/X11/locale/iso8859-1/Compose</CODE>.<P>See also Andrew D. Balsa's comments at
<A HREF="http://wauug.erols.com/~balsa/linux/deadkeys/index.html">http://wauug.erols.com/~balsa/linux/deadkeys/index.html</A>.
</LI>
<LI>The emacs mechanism obtained by loading "iso-insert.el" or

View File

@ -0,0 +1,326 @@
XXX: reverted upstream
---
data/keymaps/i386/azerty/fr-latin9.map | 1 +
data/keymaps/i386/fgGIod/tr_f-latin5.map | 1 +
data/keymaps/i386/qwerty/bg-cp1251.map | 1 +
data/keymaps/i386/qwerty/bg_bds-cp1251.map | 1 +
data/keymaps/i386/qwerty/br-abnt.map | 1 +
data/keymaps/i386/qwerty/by.map | 1 +
data/keymaps/i386/qwerty/cz-cp1250.map | 1 +
data/keymaps/i386/qwerty/cz-lat2-prog.map | 1 +
data/keymaps/i386/qwerty/cz-lat2.map | 1 +
data/keymaps/i386/qwerty/cz.map | 8 ++++----
data/keymaps/i386/qwerty/defkeymap.map | 1 +
data/keymaps/i386/qwerty/defkeymap_V1.0.map | 1 +
data/keymaps/i386/qwerty/lt.baltic.map | 1 +
data/keymaps/i386/qwerty/lt.l4.map | 1 +
data/keymaps/i386/qwerty/lt.map | 1 +
data/keymaps/i386/qwerty/pl2.map | 1 +
data/keymaps/i386/qwerty/sk-prog-qwerty.map | 1 +
data/keymaps/i386/qwerty/ua-utf-ws.map | 1 +
data/keymaps/i386/qwerty/ua-utf.map | 1 +
data/keymaps/i386/qwerty/ua-ws.map | 1 +
data/keymaps/i386/qwerty/ua.map | 1 +
data/keymaps/i386/qwerty/us-acentos.map | 1 +
data/keymaps/i386/qwertz/cz-us-qwertz.map | 1 +
data/keymaps/i386/qwertz/sk-prog-qwertz.map | 1 +
24 files changed, 27 insertions(+), 4 deletions(-)
Index: kbd-1.15.2/data/keymaps/i386/azerty/fr-latin9.map
===================================================================
--- kbd-1.15.2.orig/data/keymaps/i386/azerty/fr-latin9.map
+++ kbd-1.15.2/data/keymaps/i386/azerty/fr-latin9.map
@@ -418,6 +418,7 @@ keycode 100 = AltGr
# La touche Ctrl+Pause = Attn = 101 a un code pour elle-męme
#
keycode 101 = Break
+ control keycode 101 = Control_c
keycode 102 = Home
Index: kbd-1.15.2/data/keymaps/i386/fgGIod/tr_f-latin5.map
===================================================================
--- kbd-1.15.2.orig/data/keymaps/i386/fgGIod/tr_f-latin5.map
+++ kbd-1.15.2/data/keymaps/i386/fgGIod/tr_f-latin5.map
@@ -217,6 +217,7 @@ keycode 99 = VoidSymbol
alt keycode 99 = Control_backslash
keycode 100 = AltGr
keycode 101 = Break
+ control keycode 101 = Control_c
keycode 102 = Find
keycode 103 = Up
keycode 104 = Prior
Index: kbd-1.15.2/data/keymaps/i386/qwerty/bg-cp1251.map
===================================================================
--- kbd-1.15.2.orig/data/keymaps/i386/qwerty/bg-cp1251.map
+++ kbd-1.15.2/data/keymaps/i386/qwerty/bg-cp1251.map
@@ -312,6 +312,7 @@ keycode 99 = Control_backslash
altgr alt keycode 99 = Control_backslash
keycode 100 = AltGr
keycode 101 = Break
+ control keycode 101 = Control_c
keycode 102 = Find
keycode 103 = Up
keycode 104 = Prior
Index: kbd-1.15.2/data/keymaps/i386/qwerty/bg_bds-cp1251.map
===================================================================
--- kbd-1.15.2.orig/data/keymaps/i386/qwerty/bg_bds-cp1251.map
+++ kbd-1.15.2/data/keymaps/i386/qwerty/bg_bds-cp1251.map
@@ -638,6 +638,7 @@ keycode 98 = KP_Divide
keycode 99 = Control_backslash
keycode 100 = AltGr
keycode 101 = Break
+ control keycode 101 = Control_c
keycode 102 = Find
keycode 103 = Up
keycode 104 = Prior
Index: kbd-1.15.2/data/keymaps/i386/qwerty/br-abnt.map
===================================================================
--- kbd-1.15.2.orig/data/keymaps/i386/qwerty/br-abnt.map
+++ kbd-1.15.2/data/keymaps/i386/qwerty/br-abnt.map
@@ -197,6 +197,7 @@ keycode 99 = VoidSymbol
alt keycode 99 = Control_backslash
keycode 100 = AltGr
keycode 101 = Break
+ control keycode 101 = Control_c
keycode 102 = Find
keycode 103 = Up
keycode 104 = Prior
Index: kbd-1.15.2/data/keymaps/i386/qwerty/by.map
===================================================================
--- kbd-1.15.2.orig/data/keymaps/i386/qwerty/by.map
+++ kbd-1.15.2/data/keymaps/i386/qwerty/by.map
@@ -529,6 +529,7 @@ keycode 99 = VoidSymbol Control_backsl
Meta_Control_backslash Meta_Control_backslash Meta_Control_backslash
keycode 100 = Alt
keycode 101 = Break
+ control keycode 101 = Control_c
keycode 102 = Find
keycode 103 = Up Up Up \
KeyboardSignal Up Up \
Index: kbd-1.15.2/data/keymaps/i386/qwerty/cz-cp1250.map
===================================================================
--- kbd-1.15.2.orig/data/keymaps/i386/qwerty/cz-cp1250.map
+++ kbd-1.15.2/data/keymaps/i386/qwerty/cz-cp1250.map
@@ -138,6 +138,7 @@ keycode 99 = VoidSymbol
alt keycode 99 = Control_backslash
keycode 100 = AltGr
keycode 101 = Break
+ control keycode 101 = Control_c
keycode 102 = Find
keycode 103 = Up
keycode 104 = Prior
Index: kbd-1.15.2/data/keymaps/i386/qwerty/cz-lat2-prog.map
===================================================================
--- kbd-1.15.2.orig/data/keymaps/i386/qwerty/cz-lat2-prog.map
+++ kbd-1.15.2/data/keymaps/i386/qwerty/cz-lat2-prog.map
@@ -141,6 +141,7 @@ keycode 99 = VoidSymbol
alt keycode 99 = Control_backslash
keycode 100 = AltGr
keycode 101 = Break
+ control keycode 101 = Control_c
keycode 102 = Find
keycode 103 = Up
keycode 104 = Prior Scroll_Backward Prior Scroll_Backward VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol
Index: kbd-1.15.2/data/keymaps/i386/qwerty/cz-lat2.map
===================================================================
--- kbd-1.15.2.orig/data/keymaps/i386/qwerty/cz-lat2.map
+++ kbd-1.15.2/data/keymaps/i386/qwerty/cz-lat2.map
@@ -138,6 +138,7 @@ keycode 99 = VoidSymbol
alt keycode 99 = Control_backslash
keycode 100 = AltGr
keycode 101 = Break
+ control keycode 101 = Control_c
keycode 102 = Find
keycode 103 = Up
keycode 104 = Prior Scroll_Backward Prior Scroll_Backward VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol
Index: kbd-1.15.2/data/keymaps/i386/qwerty/cz.map
===================================================================
--- kbd-1.15.2.orig/data/keymaps/i386/qwerty/cz.map
+++ kbd-1.15.2/data/keymaps/i386/qwerty/cz.map
@@ -1086,13 +1086,13 @@ keycode 99 = dead_acute dead_acute
keycode 100 = AltGr
#
#keycode 101 = Break
-keycode 101 = Break Break VoidSymbol VoidSymbol VoidSymbol \
- VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol \
+keycode 101 = Break Break VoidSymbol VoidSymbol Control_c \
+ Control_c VoidSymbol VoidSymbol VoidSymbol VoidSymbol \
VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol \
VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol \
VoidSymbol \
- Break Break VoidSymbol VoidSymbol VoidSymbol \
- VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol \
+ Break Break VoidSymbol VoidSymbol Control_c \
+ Control_c VoidSymbol VoidSymbol VoidSymbol VoidSymbol \
VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol \
VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol \
VoidSymbol
Index: kbd-1.15.2/data/keymaps/i386/qwerty/defkeymap.map
===================================================================
--- kbd-1.15.2.orig/data/keymaps/i386/qwerty/defkeymap.map
+++ kbd-1.15.2/data/keymaps/i386/qwerty/defkeymap.map
@@ -222,6 +222,7 @@ keycode 99 = VoidSymbol
alt keycode 99 = Control_backslash
keycode 100 = AltGr
keycode 101 = Break
+ control keycode 101 = Control_c
keycode 102 = Find
keycode 103 = Up
keycode 104 = Prior
Index: kbd-1.15.2/data/keymaps/i386/qwerty/defkeymap_V1.0.map
===================================================================
--- kbd-1.15.2.orig/data/keymaps/i386/qwerty/defkeymap_V1.0.map
+++ kbd-1.15.2/data/keymaps/i386/qwerty/defkeymap_V1.0.map
@@ -185,6 +185,7 @@ keycode 99 = VoidSymbol
alt keycode 99 = Control_backslash
keycode 100 = AltGr
keycode 101 = Break
+ control keycode 101 = Control_c
keycode 102 = Find
keycode 103 = Up
keycode 104 = Prior
Index: kbd-1.15.2/data/keymaps/i386/qwerty/lt.baltic.map
===================================================================
--- kbd-1.15.2.orig/data/keymaps/i386/qwerty/lt.baltic.map
+++ kbd-1.15.2/data/keymaps/i386/qwerty/lt.baltic.map
@@ -171,6 +171,7 @@ keycode 99 = VoidSymbol
alt keycode 99 = Control_backslash
keycode 100 = AltGr
keycode 101 = Break
+ control keycode 101 = Control_c
keycode 102 = Find
keycode 103 = Up
keycode 104 = Prior
Index: kbd-1.15.2/data/keymaps/i386/qwerty/lt.l4.map
===================================================================
--- kbd-1.15.2.orig/data/keymaps/i386/qwerty/lt.l4.map
+++ kbd-1.15.2/data/keymaps/i386/qwerty/lt.l4.map
@@ -463,6 +463,7 @@ keycode 99 = VoidSymbol # 99=Print-Scr
alt keycode 99 = Control_backslash
keycode 100 = AltGr
keycode 101 = Break # 101=Control-Pause
+ control keycode 101 = Control_c
string F102 = "\033[7$"
keycode 102 = Find # =Home
shift keycode 102 = F102
Index: kbd-1.15.2/data/keymaps/i386/qwerty/lt.map
===================================================================
--- kbd-1.15.2.orig/data/keymaps/i386/qwerty/lt.map
+++ kbd-1.15.2/data/keymaps/i386/qwerty/lt.map
@@ -462,6 +462,7 @@ keycode 99 = VoidSymbol # 99=Print-Scr
alt keycode 99 = Control_backslash
keycode 100 = AltGr
keycode 101 = Break # 101=Control-Pause
+ control keycode 101 = Control_c
string F102 = "\033[7$"
keycode 102 = Find # =Home
shift keycode 102 = F102
Index: kbd-1.15.2/data/keymaps/i386/qwerty/pl2.map
===================================================================
--- kbd-1.15.2.orig/data/keymaps/i386/qwerty/pl2.map
+++ kbd-1.15.2/data/keymaps/i386/qwerty/pl2.map
@@ -242,6 +242,7 @@ keycode 99 = VoidSymbol
alt keycode 99 = Control_backslash
keycode 100 = AltGr
keycode 101 = Break
+ control keycode 101 = Control_c
keycode 102 = Find
keycode 103 = Up
keycode 104 = Prior
Index: kbd-1.15.2/data/keymaps/i386/qwerty/sk-prog-qwerty.map
===================================================================
--- kbd-1.15.2.orig/data/keymaps/i386/qwerty/sk-prog-qwerty.map
+++ kbd-1.15.2/data/keymaps/i386/qwerty/sk-prog-qwerty.map
@@ -122,6 +122,7 @@ keycode 99 = VoidSymbol
alt keycode 99 = Control_backslash
keycode 100 = AltGr
keycode 101 = Break
+ control keycode 101 = Control_c
keycode 102 = Find
keycode 103 = Up
keycode 104 = Prior
Index: kbd-1.15.2/data/keymaps/i386/qwerty/ua-utf-ws.map
===================================================================
--- kbd-1.15.2.orig/data/keymaps/i386/qwerty/ua-utf-ws.map
+++ kbd-1.15.2/data/keymaps/i386/qwerty/ua-utf-ws.map
@@ -1526,6 +1526,7 @@ ctrll keycode 100 = CtrlR_Lock
ctrlr keycode 100 = CtrlR_Lock
ctrll ctrlr keycode 100 = CtrlR_Lock
keycode 101 = Break
+ control keycode 101 = Control_c
keycode 102 = Find
keycode 103 = Up
keycode 104 = Prior
Index: kbd-1.15.2/data/keymaps/i386/qwerty/ua-utf.map
===================================================================
--- kbd-1.15.2.orig/data/keymaps/i386/qwerty/ua-utf.map
+++ kbd-1.15.2/data/keymaps/i386/qwerty/ua-utf.map
@@ -1516,6 +1516,7 @@ ctrll keycode 100 = CtrlR_Lock
ctrlr keycode 100 = CtrlR_Lock
ctrll ctrlr keycode 100 = CtrlR_Lock
keycode 101 = Break
+ control keycode 101 = Control_c
keycode 102 = Find
keycode 103 = Up
keycode 104 = Prior
Index: kbd-1.15.2/data/keymaps/i386/qwerty/ua-ws.map
===================================================================
--- kbd-1.15.2.orig/data/keymaps/i386/qwerty/ua-ws.map
+++ kbd-1.15.2/data/keymaps/i386/qwerty/ua-ws.map
@@ -1521,6 +1521,7 @@ keycode 99 = VoidSymbol
alt keycode 99 = Control_backslash
keycode 100 = Alt
keycode 101 = Break
+ control keycode 101 = Control_c
keycode 102 = Find
keycode 103 = Up
keycode 104 = Prior
Index: kbd-1.15.2/data/keymaps/i386/qwerty/ua.map
===================================================================
--- kbd-1.15.2.orig/data/keymaps/i386/qwerty/ua.map
+++ kbd-1.15.2/data/keymaps/i386/qwerty/ua.map
@@ -1515,6 +1515,7 @@ ctrll keycode 100 = CtrlR_Lock
ctrlr keycode 100 = CtrlR_Lock
ctrll ctrlr keycode 100 = CtrlR_Lock
keycode 101 = Break
+ control keycode 101 = Control_c
keycode 102 = Find
keycode 103 = Up
keycode 104 = Prior
Index: kbd-1.15.2/data/keymaps/i386/qwerty/us-acentos.map
===================================================================
--- kbd-1.15.2.orig/data/keymaps/i386/qwerty/us-acentos.map
+++ kbd-1.15.2/data/keymaps/i386/qwerty/us-acentos.map
@@ -194,6 +194,7 @@ keycode 99 = VoidSymbol
alt keycode 99 = Control_backslash
keycode 100 = AltGr
keycode 101 = Break
+ control keycode 101 = Control_c
keycode 102 = Find
keycode 103 = Up
keycode 104 = Prior
Index: kbd-1.15.2/data/keymaps/i386/qwertz/cz-us-qwertz.map
===================================================================
--- kbd-1.15.2.orig/data/keymaps/i386/qwertz/cz-us-qwertz.map
+++ kbd-1.15.2/data/keymaps/i386/qwertz/cz-us-qwertz.map
@@ -135,6 +135,7 @@ control keycode 99 = Control_backslash
alt keycode 99 = Control_backslash
keycode 100 = AltGr
keycode 101 = Break
+control keycode 101 = Control_c
keycode 102 = Find
keycode 103 = Up
keycode 104 = Prior Scroll_Backward Prior Scroll_Backward VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol VoidSymbol
Index: kbd-1.15.2/data/keymaps/i386/qwertz/sk-prog-qwertz.map
===================================================================
--- kbd-1.15.2.orig/data/keymaps/i386/qwertz/sk-prog-qwertz.map
+++ kbd-1.15.2/data/keymaps/i386/qwertz/sk-prog-qwertz.map
@@ -122,6 +122,7 @@ keycode 99 = VoidSymbol
alt keycode 99 = Control_backslash
keycode 100 = AltGr
keycode 101 = Break
+ control keycode 101 = Control_c
keycode 102 = Find
keycode 103 = Up
keycode 104 = Prior

View File

@ -0,0 +1,10 @@
--- kbd-1.12/data/keymaps/i386/qwerty/sv-latin1.map.orig 2007-07-17 12:33:52.000000000 +0200
+++ kbd-1.12/data/keymaps/i386/qwerty/sv-latin1.map 2007-07-17 12:36:34.855389000 +0200
@@ -42,6 +42,7 @@
alt keycode 9 = Meta_eight
keycode 10 = nine parenright bracketright
alt keycode 10 = Meta_nine
+ control altgr keycode 10 = Control_bracketright
keycode 11 = zero equal braceright
alt keycode 11 = Meta_zero
keycode 12 = plus question backslash

View File

@ -0,0 +1,45 @@
--- a/src/unicode_start
+++ b/src/unicode_start
@@ -72,6 +72,17 @@
# have a Unicode map attached, or explicitly specified, e.g.,
# by giving `def.uni' as a second argument.
+DEFAULT_UNICODE_FONT='LatArCyrHeb-16'
+# Also drdos8x16 is a good candidate.
+
+# Fonts with 512 glyphs like LatArCyrHeb-16 make it impossible to use bold
+# on the console, which makes YaST2 unusable. To be able to use bold,
+# only fonts with 256 glyphs can be used. Therefore we prefer
+# the font specified in /etc/sysconfig/console. This should be OK because
+# the default font written to /etc/sysconfig/console by YaST2
+# is currently always a font with 256 glyphs and a Unicode map
+# which is suitable for the language used during the installation.
+
case "$#" in
2)
setfont "$1" -u "$2"
@@ -80,6 +91,24 @@
setfont "$1"
;;
0)
+ if [ -f /etc/sysconfig/console ] ; then
+ . /etc/sysconfig/console
+ fi
+ if [ -n "$CONSOLE_FONT" ] ; then
+ SETFONT_ARGS="$CONSOLE_FONT"
+ if [ -n "$CONSOLE_UNICODEMAP" ] ; then
+ SETFONT_ARGS="$SETFONT_ARGS -u $CONSOLE_UNICODEMAP"
+ fi
+ if [ -n "$CONSOLE_SCREENMAP" ] ; then
+ SETFONT_ARGS="$SETFONT_ARGS -m $CONSOLE_SCREENMAP"
+ fi
+ setfont $SETFONT_ARGS
+ if [ -n "$CONSOLE_MAGIC" -a "$CONSOLE_MAGIC" != "none" ] ; then
+ printf "\033$CONSOLE_MAGIC"
+ fi
+ else
+ setfont $DEFAULT_UNICODE_FONT
+ fi
;;
*)
echo "usage: unicode_start [font [unicode map]]"

View File

@ -0,0 +1,26 @@
Index: b/src/loadkeys.c
===================================================================
--- a/src/loadkeys.c
+++ b/src/loadkeys.c
@@ -26,6 +26,8 @@
#include "keymap.h"
static const char *const dirpath1[] = {
+ DATADIR "/" XKBKEYMAPDIR "/",
+ DATADIR "/" LEGACYKEYMAPDIR "/**",
DATADIR "/" KEYMAPDIR "/**",
KERNDIR "/",
NULL
Index: b/src/paths.h
===================================================================
--- a/src/paths.h
+++ b/src/paths.h
@@ -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"

View File

@ -0,0 +1,10 @@
Index: docs/man/man1/openvt.1
===================================================================
--- a/docs/man/man1/openvt.1.orig 2013-08-27 22:45:33.000000000 +0200
+++ b/docs/man/man1/openvt.1 2014-09-12 11:48:08.465988937 +0200
@@ -92,5 +92,4 @@
.SH "SEE ALSO"
.BR chvt (1),
-.BR doshell (8),
.BR login (1)

View File

@ -0,0 +1,33 @@
Index: data/keymaps/i386/include/euro.map
===================================================================
--- a/data/keymaps/i386/include/euro.map.orig 2012-02-27 11:27:10.000000000 +0100
+++ b/data/keymaps/i386/include/euro.map 2014-09-25 12:31:37.594749095 +0200
@@ -2,5 +2,5 @@
# [Say: "loadkeys euro" to get Euro and cent with Alt on the positions
# where many keyboards have E and C.
# To get it displayed, use a latin0 (i.e., latin9) font.]
-alt keycode 18 = currency
+alt keycode 18 = euro
alt keycode 46 = cent
Index: data/keymaps/i386/include/euro1.map
===================================================================
--- a/data/keymaps/i386/include/euro1.map.orig 2012-02-27 11:27:10.000000000 +0100
+++ b/data/keymaps/i386/include/euro1.map 2014-09-25 12:31:20.218749689 +0200
@@ -2,5 +2,5 @@
# [Say: "loadkeys euro1" to get Euro and cent with AltGr (right alt)
# on the positions where many keyboards have 5 and C.
# To get it displayed, use a latin0 (i.e., latin9) font.]
-altgr keycode 6 = currency
+altgr keycode 6 = euro
altgr keycode 46 = cent
Index: data/keymaps/i386/include/euro2.map
===================================================================
--- a/data/keymaps/i386/include/euro2.map.orig 2012-02-27 11:27:10.000000000 +0100
+++ b/data/keymaps/i386/include/euro2.map 2014-09-25 12:31:52.098748600 +0200
@@ -2,5 +2,5 @@
# [Say: "loadkeys euro2" to get Euro and cent with AltGr (right alt)
# on the positions where many keyboards have E and C.
# To get it displayed, use a latin0 (i.e., latin9) font.]
-altgr keycode 18 = currency
+altgr keycode 18 = euro
altgr keycode 46 = cent

View File

@ -0,0 +1,105 @@
diff -Ndurp kbd-2.0.2/contrib/font2psf kbd-2.0.2-fix-bashisms/contrib/font2psf
--- kbd-2.0.2/contrib/font2psf 2012-02-27 12:27:10.000000000 +0200
+++ kbd-2.0.2-fix-bashisms/contrib/font2psf 2014-10-19 23:07:11.719239190 +0300
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#written by Martin Lohner, SuSE GmbH, Dec 1998
echo "This script converts 256 character font to psf-fonts"
echo "It simply assumes that all files in the current directory"
@@ -15,24 +15,21 @@ read a
random=hfdsvnpoh97k
if [ $a = y -o $a = Y ] ; then
echo "Creating psf-headers..."
- echo -ne "\066" > $random
- echo -ne "\004" >> $random
- echo -ne "\000" >> $random
+ printf "\066\004\000" > $random
-
- echo -ne "\006" > $random.6.tmp
+ printf "\006" > $random.6.tmp
cat $random $random.6.tmp > $random.6
- echo -ne "\010" > $random.8.tmp
+ printf "\010" > $random.8.tmp
cat $random $random.8.tmp > $random.8
- echo -ne "\012" > $random.10.tmp
+ printf "\012" > $random.10.tmp
cat $random $random.10.tmp > $random.10
- echo -ne "\014" > $random.12.tmp
+ printf "\014" > $random.12.tmp
cat $random $random.12.tmp > $random.12
- echo -ne "\016" > $random.14.tmp
+ printf "\016" > $random.14.tmp
cat $random $random.14.tmp > $random.14
- echo -ne "\020" > $random.16.tmp
+ printf "\020" > $random.16.tmp
cat $random $random.16.tmp > $random.16
- echo -ne "\023" > $random.19.tmp
+ printf "\023" > $random.19.tmp
cat $random $random.19.tmp > $random.19
for i in 6 8 10 12 14 16 19; do
diff -Ndurp kbd-2.0.2/contrib/psfsplit kbd-2.0.2-fix-bashisms/contrib/psfsplit
--- kbd-2.0.2/contrib/psfsplit 2012-02-27 12:27:10.000000000 +0200
+++ kbd-2.0.2-fix-bashisms/contrib/psfsplit 2014-10-19 22:53:02.271296655 +0300
@@ -11,17 +11,17 @@ then echo $1 -- non .psf file
exit
fi
size=`hexdump -e '/1 "%i" ' -n1 -s2 $1 `
-size=$[ ($size % 2 + 1) * 256 ]
+size=$((($size % 2 + 1) * 256))
height=`hexdump -e '/1 "%i" ' -n1 -s3 $1 `
echo $size chars, height=$height
mkdir $1_
-dd bs=4 count=1 if=$1 of=$1_/#psf_header &>/dev/null
+dd bs=4 count=1 if=$1 of=$1_/#psf_header >/dev/null 2>&1
i=0
-while let $[ i < $size ]
+while [ $i -lt $size ]
do
- dd bs=1 count=$height skip=$[ $i * $height + 4 ] if=$1 \
- of=$1_/`printf "%.3x" $i` &>/dev/null
- let i+=1
+ dd bs=1 count=$height skip=$(($i * $height + 4)) if=$1 \
+ of=$1_/`printf "%.3x" $i` >/dev/null 2>&1
+ i=$((i + 1))
done
-dd bs=1 skip=$[ $i * $height + 4 ] if=$1 of=$1_/map_tables &>/dev/null
+dd bs=1 skip=$(($i * $height + 4)) if=$1 of=$1_/map_tables >/dev/null 2>&1
diff -Ndurp kbd-2.0.2/contrib/showconsolefont kbd-2.0.2-fix-bashisms/contrib/showconsolefont
--- kbd-2.0.2/contrib/showconsolefont 2012-02-27 12:27:10.000000000 +0200
+++ kbd-2.0.2-fix-bashisms/contrib/showconsolefont 2014-10-19 22:58:03.106276304 +0300
@@ -5,16 +5,16 @@
# A small shell script version of the `showconsolefont' C program
#
-echo -e "\033%G"
+printf "\033%%G\n"
for L in "0 2 4 6" "1 3 5 7"; do
for P in 0 1 2 3 4 5 6 7; do
for U in 0 1 2 3; do
for K in $L; do
- echo -ne " \357\20$U\2$K$P"
+ printf " \357\20$U\2$K$P"
done
done
echo
done
echo
done
-echo -ne "\033%@"
+printf "\033%%@"
diff -Ndurp kbd-2.0.2/rc/suse-kbd.rc kbd-2.0.2-fix-bashisms/rc/suse-kbd.rc
--- kbd-2.0.2/rc/suse-kbd.rc 2012-02-27 12:27:11.000000000 +0200
+++ kbd-2.0.2-fix-bashisms/rc/suse-kbd.rc 2014-10-19 23:00:34.475266064 +0300
@@ -76,7 +76,7 @@ case "$1" in
else
return=$rc_failed
fi
- echo -e "Loading keymap ${retmsg#Loading*/usr/lib/kbd/keymaps/*/}${return}"
+ printf "Loading keymap ${retmsg#Loading*/usr/lib/kbd/keymaps/*/}${return}\n"
;;
stop)
;;

BIN
kbd-2.6.4-repack.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

71
kbd-unicode-fxxx.patch Normal file
View File

@ -0,0 +1,71 @@
Disable characters >=U+F000. These do not work properly.
Explanation from Alexey Gladkov:
The kbd value is unsigned short [1] and take a look how kernel gets
a type [2]. The last bytes are occupied by type.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/kd.h?id=06dd3dfeea60e2a6457a6aedf97afc8e6d2ba497#n103
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/keyboard.h?id=06dd3dfeea60e2a6457a6aedf97afc8e6d2ba497#n45
The problem in the kernel. In the kb_value there is no room to store such
values.
Index: kbd-2.0.4/data/keymaps/i386/qwertz/de_alt_UTF-8.map
===================================================================
--- kbd-2.0.4.orig/data/keymaps/i386/qwertz/de_alt_UTF-8.map
+++ kbd-2.0.4/data/keymaps/i386/qwertz/de_alt_UTF-8.map
@@ -160,7 +160,7 @@ shift alt keycode 2 = U+00AC # notsig
shift alt keycode 3 = U+201D # right double quote
shift alt keycode 4 = numbersign
shift alt keycode 5 = sterling
-shift alt keycode 6 = U+FB01 # fi ligature
+#shift alt keycode 6 = U+FB01 # fi ligature
shift alt keycode 7 = dead_circumflex
shift alt keycode 8 = backslash
shift alt keycode 9 = U+02DC # small tilde
@@ -179,7 +179,7 @@ shift alt keycode 23 = Ucircumflex
shift alt keycode 24 = Ooblique
shift alt keycode 25 = U+220F # n-ary product
shift alt keycode 26 = degree
-shift alt keycode 27 = U+F8FF # apple logo
+#shift alt keycode 27 = U+F8FF # apple logo
shift alt keycode 30 = Aring
shift alt keycode 31 = Iacute
shift alt keycode 32 = U+2122 # trade mark
@@ -188,7 +188,7 @@ shift alt keycode 34 = Igrave
shift alt keycode 35 = Oacute
shift alt keycode 36 = U+0131 # dotless i
shift alt keycode 37 = U+02C6 # circumflex accent
-shift alt keycode 38 = U+FB02 # fl ligature
+#shift alt keycode 38 = U+FB02 # fl ligature
shift alt keycode 39 = U+0152 # OE
shift alt keycode 40 = AE
shift alt keycode 41 = U+201C # left double quote
@@ -210,7 +210,7 @@ control shift alt keycode 2 = U+00AC
control shift alt keycode 3 = U+201D # right double quote
control shift alt keycode 4 = numbersign
control shift alt keycode 5 = sterling
-control shift alt keycode 6 = U+FB01 # fi ligature
+#control shift alt keycode 6 = U+FB01 # fi ligature
control shift alt keycode 7 = circumflex
control shift alt keycode 8 = backslash
control shift alt keycode 9 = U+02DC # small tilde
@@ -229,7 +229,7 @@ control shift alt keycode 23 = Ucircumf
control shift alt keycode 24 = Ooblique
control shift alt keycode 25 = U+220F # n-ary product
control shift alt keycode 26 = degree
-control shift alt keycode 27 = U+F8FF # apple logo
+#control shift alt keycode 27 = U+F8FF # apple logo
control shift alt keycode 30 = Aring
control shift alt keycode 31 = Iacute
control shift alt keycode 32 = U+2122 # trade mark
@@ -238,7 +238,7 @@ control shift alt keycode 34 = Igrave
control shift alt keycode 35 = Oacute
control shift alt keycode 36 = U+0131 # dotless i
control shift alt keycode 37 = U+02C6 # circumflex accent
-control shift alt keycode 38 = U+FB02 # fl ligature
+#control shift alt keycode 38 = U+FB02 # fl ligature
control shift alt keycode 39 = U+0152 # OE
control shift alt keycode 40 = AE
control shift alt keycode 41 = U+201C # left double quote

2096
kbd.changes Normal file

File diff suppressed because it is too large Load Diff

526
kbd.spec Normal file
View File

@ -0,0 +1,526 @@
#
# spec file for package kbd
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
#Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
%define _fillupdir /var/adm/fillup-templates
%endif
%define legacy_folders amiga,atari,i386,include,mac,ppc,sun
Name: kbd
Version: 2.6.4
Release: 0
Summary: Keyboard and Font Utilities
# git: git://git.altlinux.org/people/legion/packages/kbd.git
License: GPL-2.0-or-later AND GPL-3.0-or-later
Group: System/Console
URL: http://kbd-project.org/
# repack_kbd.sh on https://www.kernel.org/pub/linux/utils/kbd/kbd-%%{version}.tar.xz
Source: %{name}-%{version}-repack.tar.xz
Source1: kbd_fonts.tar.bz2
Source2: suse-add.tar.bz2
Source3: README.SUSE
Source4: vlock.pamd
Source8: sysconfig.console
Source9: sysconfig.keyboard
Source10: autogen.sh
Source11: fbtest.c
Source12: fbtest.8
Source15: cz-map.patch
Source20: kbdsettings
Source21: kbdsettings.service
Source22: numlockbios.c
Source42: convert-kbd-mac.sed
Source43: repack_kbd.sh
Source44: xml2lst.pl
Source45: genmap4systemd.sh
Patch0: kbd-1.15.2-prtscr_no_sigquit.patch
# PATCH-FIX-UPSTREAM
Patch2: kbd-1.15.2-unicode_scripts.patch
Patch3: kbd-1.15.2-docu-X11R6-xorg.patch
Patch4: kbd-1.15.2-sv-latin1-keycode10.patch
Patch10: kbd-2.0.2-doshell-reference.patch
Patch11: kbd-2.0.2-euro-unicode.patch
Patch12: kbd-2.0.2-fix-bashisms.patch
# Patch13: adds xkb and legacy keymaps subdirs to loadkyes search path
# (openSUSE FATE#318355, sle FATE#318426)
Patch13: kbd-1.15.5-loadkeys-search-path.patch
# PATCH-FEATURE-OPENSUSE kbdsettings-nox86.patch sbrabec@suse.cz -- Disable "bios" option for NumLock settings on non x86 platforms.
Patch14: kbdsettings-nox86.patch
# PATCH-FIX-SLE kbd-unicode-fxxx.patch sbrabec@suse.com bsc1085432 -- Do not cause error on UNICODE characters >= 0xF000 (e. g. ligature fi)
Patch15: kbd-unicode-fxxx.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: bison
BuildRequires: check-devel
BuildRequires: console-setup
BuildRequires: fdupes
BuildRequires: flex
BuildRequires: gcc >= 4.6
BuildRequires: libtool
BuildRequires: pam-devel
BuildRequires: pkgconfig
BuildRequires: suse-module-tools
BuildRequires: xkeyboard-config
BuildRequires: xz
# Temporarily require -legacy
Requires: %{name}-legacy = %{version}-%{release}
Requires(post): coreutils
Requires(postun):coreutils
Requires(pre): %fillup_prereq
Provides: vlock = 2.2.3
Obsoletes: vlock <= 2.2.3
%description
Load and save keyboard mappings. This is needed if you are not using
the US keyboard map. This package also contains utilities for changing
your console fonts. If you install this package, YaST includes an extra
menu to allow you to choose between the different fonts. This package
also includes fonts from the kbd_fonts.tar.gz package (by Paul
Gortmaker) on Sunsite.
%package legacy
Summary: Legacy data for kbd package
Group: System/Console
BuildArch: noarch
%description legacy
The %{name}-legacy package contains original keymaps for kbd package.
Please note that %{name}-legacy is not helpful without kbd.
%define kbd %{_datadir}/kbd
%prep
%setup -q -a 1 -a 2 -n kbd-%{version}
cp -fp %{SOURCE8} .
cp -fp %{SOURCE9} .
cp -fp %{SOURCE10} .
cp -fp %{SOURCE44} .
cp -fp %{SOURCE45} .
cp -fp %{SOURCE20} .
cp -fp %{SOURCE21} .
cp -fp %{SOURCE22} .
%autopatch -p1
%ifarch %{ix86} x86_64
%patch14 -p1 -R
%endif
%build
for i in `find data/keymaps/mac -type f` ; do
sed -i -f %{SOURCE42} $i
done
# workaround ambiguous keymap names
pushd data/keymaps/i386
# bnc#48301
test -f qwerty/se-latin1.map || cp qwerty/sv-latin1.map qwerty/se-latin1.map
# bnc#435121
test -f olpc/es-olpc.map || mv olpc/es.map olpc/es-olpc.map
# Rename conflicting keymaps, as Fedora do
#test -f dvorak/no.map || mv dvorak/no.map dvorak/no-dvorak.map
test -f fgGIod/trf.map || mv fgGIod/trf.map fgGIod/trf-fgGIod.map
test -f olpc/pt.map || mv olpc/pt.map olpc/pt-olpc.map
test -f qwerty/cz.map || mv qwerty/cz.map qwerty/cz-qwerty.map
popd
chmod 755 autogen.sh
./autogen.sh
%configure \
--disable-silent-rules \
--datadir=%{kbd} \
--enable-nls \
--localedir=%{_datadir}/locale \
--enable-optional-progs \
--disable-static
make %{?_smp_mflags}
gcc %{optflags} -o fbtest $RPM_SOURCE_DIR/fbtest.c
%ifarch %{ix86} x86_64
gcc %{optflags} -o numlockbios $RPM_SOURCE_DIR/numlockbios.c
%endif
# fix lat2-16.psfu (bnc#340579)
font=data/consolefonts/lat2a-16.psfu
./src/psfxtable -i $font -it data/unimaps/lat2u.uni \
-o t.psfu
mv t.psfu $font
make %{?_smp_mflags}
%install
mkdir -p %{buildroot}%{_sbindir}
DOC=%{buildroot}%{_defaultdocdir}/kbd
KBD=%{kbd}
K=%{buildroot}$KBD
mkdir -p $K/consolefonts
# First install the fonts from the kbd_fonts directory
# (allowing kbd to overwrite some of them)
mkdir -p $DOC/fonts
install -m 644 fonts/README $DOC/fonts/README.fonts
install -m 644 fonts/*/* $K/consolefonts/
# Now call kbd install
echo "# Now call kbd install DESTDIR=%{buildroot} DATA_DIR=%{kbd} MAN_DIR=%{_mandir}"
make DESTDIR=%{buildroot} DATA_DIR=%{kbd} MAN_DIR=%{_mandir} install
# ln -s iso01-12x22.psfu $K/consolefonts/suse12x22.psfu
install -m 644 data/consolefonts/README* $DOC/fonts/
mkdir -p $DOC/doc/
install -m 644 docs/doc/keysyms.h.info docs/doc/kbd.FAQ.txt docs/doc/kbd.FAQ*.html docs/doc/README* docs/doc/TODO $DOC/doc/
install -m 644 docs/doc/as400.kbd docs/doc/console.docs docs/doc/repeat/set_kbd_repeat-2 $DOC/doc/
echo "See %{_datadir}/i18/charmaps for a description of char maps" >$DOC/doc/README.charmaps
install -m 644 CREDITS README $DOC/
install -m 644 %{SOURCE3} $DOC/
rm -f $K/consolefonts/README* $K/consolefonts/ERRORS.gz
if ls $K/consolefonts/Agafari-* > /dev/null 2>&1; then
echo "";
echo "ERROR: Ethiopian Agafari fonts are for noncommercial distribution only."
echo "please run repack_kbd.sh";
echo "";
exit 1
fi
ln -sf us.map.gz $K/keymaps/i386/qwerty/khmer.map.gz
ln -sf us.map.gz $K/keymaps/i386/qwerty/ara.map.gz
ln -sf us.map.gz $K/keymaps/i386/qwerty/ir.map.gz
ln -sf us.map.gz $K/keymaps/i386/qwerty/chinese.map.gz
ln -sf us.map.gz $K/keymaps/i386/qwerty/taiwanese.map.gz
ln -sf sr-cy.map.gz $K/keymaps/i386/qwerty/sr-latin.map.gz
# Compatability links; don't know what the first three are good for.
# The others are for yast/langselection and should be removed as soon as
# yast knows about it.
#ln -sf de-latin1-nodeadkeys.map.gz \
# $K/keymaps/i386/qwertz/de-lat1-nd.map.gz
#ln -sf ru1.map.gz $K/keymaps/i386/qwerty/russian.map.gz
#ln -sf sg-latin1-lk450.map.gz \
# $K/keymaps/i386/qwertz/sg-l1-lk450.map.gz
# The next two links are for yast-language choise; should be obsolete
# with the next yast version (on 6.1)
#ln -sf lat1-16.psfu.gz $K/consolefonts/lat1u-16.psf.gz
#ln -sf lat2-16.psfu.gz $K/consolefonts/lat2u-16.psf.gz
#
# This is for stupid default font search
rm -f $K/consolefonts/default8x16.gz
ln -sf default8x16.psfu.gz $K/consolefonts/default8x16.gz
#
rm -f $K/keymaps/i386/qwerty/*~ $K/keymaps/i386/qwerty/*,v
#
# this is until the Cyr* font are not part of the package
rm -f $K/consolefonts/Cyr_a8x14.gz
ln -sf Cyr_a8x14.psfu.gz $K/consolefonts/Cyr_a8x14.gz
rm -f $K/consolefonts/Cyr_a8x16.gz
ln -sf Cyr_a8x16.psfu.gz $K/consolefonts/Cyr_a8x16.gz
rm -f $K/consolefonts/Cyr_a8x8.gz
ln -sf Cyr_a8x8.psfu.gz $K/consolefonts/Cyr_a8x8.gz
#
find $K -name \*.orig | xargs -r rm -vf
# add some missing maps to mac and remap french board
(
cd $K/keymaps/mac/all
pwd
#ln -s mac-fr-latin1.map.gz mac-fr_CH-latin1.map.gz
#ln -s mac-fr-latin1.map.gz mac-fr.map.gz
for i in \
mac-es.map.gz \
mac-it.map.gz \
mac-pt-latin1.map.gz \
mac-br-abnt2.map.gz \
mac-gr.map.gz \
mac-dk-latin1.map.gz \
mac-no-latin1.map.gz \
mac-fi-latin1.map.gz \
mac-cz-us-qwertz.map.gz \
mac-hu.map.gz \
mac-Pl02.map.gz \
mac-ru1.map.gz \
mac-jp106.map.gz
do test -f $i || ln -sv mac-us.map.gz $i
done
)
FILLUP_DIR=%{buildroot}%{_fillupdir}
mkdir -p $FILLUP_DIR
install -m 644 sysconfig.console $FILLUP_DIR/sysconfig.console
install -m 644 sysconfig.keyboard $FILLUP_DIR/sysconfig.keyboard
%ifnarch %{ix86} x86_64
rm -f %{buildroot}%{_mandir}/man8/resizecons.8*
%endif
%ifarch %{sparc} m68k
rm -f %{buildroot}%{_mandir}/man8/getkeycodes.8*
rm -f %{buildroot}%{_mandir}/man8/setkeycodes.8*
%endif
install -m 755 fbtest %{buildroot}%{_sbindir}
%ifarch %{ix86} x86_64
install -d %{buildroot}%{_libexecdir}/%{name}
install -m 755 numlockbios %{buildroot}%{_libexecdir}/%{name}
%endif
%if %{defined _distconfdir}
rm -rf %{buildroot}%{_sysconfdir}/pam.d
install -d %{buildroot}%{_pam_vendordir}
install -m 644 %{SOURCE4} %{buildroot}%{_pam_vendordir}/vlock
%else
install -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/pam.d/vlock
%endif
install -m 644 %{SOURCE12} %{buildroot}%{_mandir}/man8/
%if 0%{?suse_version} < 1550
mkdir -p %{buildroot}/bin
mkdir -p %{buildroot}/sbin
ln -s %{_bindir}/chvt %{buildroot}/bin
ln -s %{_bindir}/clrunimap %{buildroot}/bin
ln -s %{_bindir}/deallocvt %{buildroot}/bin
ln -s %{_bindir}/dumpkeys %{buildroot}/bin
ln -s %{_bindir}/fgconsole %{buildroot}/bin
ln -s %{_bindir}/getunimap %{buildroot}/bin
ln -s %{_bindir}/kbd_mode %{buildroot}/bin
ln -s %{_bindir}/kbdinfo %{buildroot}/bin
ln -s %{_bindir}/kbdrate %{buildroot}/bin
ln -s %{_bindir}/loadkeys %{buildroot}/bin
ln -s %{_bindir}/loadunimap %{buildroot}/bin
ln -s %{_bindir}/mapscrn %{buildroot}/bin
ln -s %{_bindir}/openvt %{buildroot}/bin
ln -s %{_bindir}/outpsfheader %{buildroot}/bin
ln -s %{_bindir}/psfaddtable %{buildroot}/bin
ln -s %{_bindir}/psfgettable %{buildroot}/bin
ln -s %{_bindir}/psfstriptable %{buildroot}/bin
ln -s %{_bindir}/psfxtable %{buildroot}/bin
ln -s %{_bindir}/screendump %{buildroot}/bin
ln -s %{_bindir}/setfont %{buildroot}/bin
ln -s %{_bindir}/setleds %{buildroot}/bin
ln -s %{_bindir}/setlogcons %{buildroot}/bin
ln -s %{_bindir}/setmetamode %{buildroot}/bin
ln -s %{_bindir}/setpalette %{buildroot}/bin
ln -s %{_bindir}/setvesablank %{buildroot}/bin
ln -s %{_bindir}/setvtrgb %{buildroot}/bin
ln -s %{_bindir}/showconsolefont %{buildroot}/bin
ln -s %{_bindir}/showkey %{buildroot}/bin
ln -s %{_bindir}/spawn_console %{buildroot}/bin
ln -s %{_bindir}/spawn_login %{buildroot}/bin
ln -s %{_bindir}/unicode_start %{buildroot}/bin
ln -s %{_bindir}/unicode_stop %{buildroot}/bin
ln -s %{_sbindir}/fbtest %{buildroot}/sbin
%ifnarch %{sparc} m68k
ln -s %{_bindir}/getkeycodes %{buildroot}/bin
ln -s %{_bindir}/setkeycodes %{buildroot}/bin
%endif
%ifarch %{ix86} x86_64
ln -s %{_bindir}/resizecons %{buildroot}/bin
%endif
%endif
# Make sure Perl has a locale where uc/lc works for unicode codepoints
# see e.g. https://perldoc.perl.org/perldiag.html#Wide-character-(U%2b%25X)-in-%25s
export LC_ALL=C.utf-8
# Convert X keyboard layouts to console keymaps
mkdir -p %{buildroot}%{kbd}/keymaps/xkb
perl xml2lst.pl < %{_datadir}/X11/xkb/rules/base.xml > layouts-variants.lst
while read line; do
XKBLAYOUT=`echo "$line" | cut -d " " -f 1`
echo "$XKBLAYOUT" >> layouts-list.lst
XKBVARIANT=`echo "$line" | cut -d " " -f 2`
ckbcomp "$XKBLAYOUT" "$XKBVARIANT" > /tmp/"$XKBLAYOUT"-"$XKBVARIANT".map
# skip converted layouts which cannot input ASCII (rh#1031848)
grep -q "U+0041" /tmp/"$XKBLAYOUT"-"$XKBVARIANT".map && \
gzip -cn9 /tmp/"$XKBLAYOUT"-"$XKBVARIANT".map > %{buildroot}%{kbd}/keymaps/xkb/"$XKBLAYOUT"-"$XKBVARIANT".map.gz
rm /tmp/"$XKBLAYOUT"-"$XKBVARIANT".map
done < layouts-variants.lst
# Convert X keyboard layouts (plain, no variant)
cat layouts-list.lst | sort -u >> layouts-list-uniq.lst
while read line; do
ckbcomp "$line" > /tmp/"$line".map
grep -q "U+0041" /tmp/"$line".map && \
gzip -cn9 /tmp/"$line".map > %{buildroot}%{kbd}/keymaps/xkb/"$line".map.gz
rm /tmp/"$line".map
done < layouts-list-uniq.lst
# Rename the converted default fi (kotoistus) layout (rh#1117891)
mv %{buildroot}%{kbd}/keymaps/xkb/fi.map.gz %{buildroot}%{kbd}/keymaps/xkb/fi-kotoistus.map.gz
# Fix converted cz layout - add compose rules (rh#1181581)
gunzip %{buildroot}%{kbd}/keymaps/xkb/cz.map.gz
patch %{buildroot}%{kbd}/keymaps/xkb/cz.map < %{SOURCE15}
rm -f %{buildroot}%{kbd}/keymaps/xkb/cz.map.orig
gzip -n9 %{buildroot}%{kbd}/keymaps/xkb/cz.map
# Generate entries for systemd's /usr/share/systemd/kbd-model-map
mkdir -p %{buildroot}%{_datadir}/systemd
bash ./genmap4systemd.sh %{buildroot}%{kbd}/keymaps/xkb \
> %{buildroot}%{_datadir}/systemd/kbd-model-map.xkb-generated
install -m0755 kbdsettings %{buildroot}%{_sbindir}/
install -d %{buildroot}%{_prefix}/lib/systemd/system
install -m0644 kbdsettings.service %{buildroot}%{_prefix}/lib/systemd/system
%fdupes -s %{buildroot}%{_datadir}
%find_lang %{name}
%pre
%{service_add_pre kbdsettings.service}
# move outdated pam.d/*.rpmsave files away
test -f /etc/pam.d/vlock.rpmsave && mv -v /etc/pam.d/vlock.rpmsave /etc/pam.d/vlock.rpmsave.old ||:
%post
%{fillup_only -n console}
%{fillup_only -n keyboard}
# Variables deleted before Leap 15 and SLE 15
%{remove_and_set -n keyboard KEYTABLE COMPOSETABLE}
%ifnarch %{ix86} x86_64
# "bios" was accepted but ingnored on non-x86 platforms up to Leap 42.* and SLE 12.*
sed -i 's/^KBD_NUMLOCK="bios"/KBD_NUMLOCK="no"/' /etc/sysconfig/keyboard
%endif
%{service_add_post kbdsettings.service}
%{?regenerate_initrd_post}
%preun
%{service_del_preun kbdsettings.service}
%postun
%{service_del_postun kbdsettings.service}
%{?regenerate_initrd_post}
%posttrans
%{?regenerate_initrd_posttrans}
# Migration to /usr/etc.
test -f /etc/pam.d/vlock.rpmsave && mv -v /etc/pam.d/vlock.rpmsave /etc/pam.d/vlock ||:
%files -f %{name}.lang
#config(noreplace) /etc/sysconfig/console
%license COPYING
%doc %{_defaultdocdir}/kbd
#doc CREDITS README
%{_fillupdir}/sysconfig.console
%{_fillupdir}/sysconfig.keyboard
%{kbd}
%exclude %{kbd}/keymaps/{%{legacy_folders}}
%if 0%{?suse_version} < 1550
/sbin/fbtest
/bin/chvt
/bin/openvt
/bin/deallocvt
/bin/dumpkeys
%ifnarch %{sparc} m68k
/bin/getkeycodes
/bin/setkeycodes
%endif
/bin/fgconsole
/bin/kbd_mode
/bin/kbdinfo
/bin/loadkeys
/bin/loadunimap
/bin/mapscrn
/bin/psfaddtable
/bin/psfgettable
/bin/psfstriptable
/bin/psfxtable
%ifarch %{ix86} x86_64
/bin/resizecons
%endif
/bin/setfont
/bin/setleds
/bin/setmetamode
/bin/setvtrgb
/bin/showconsolefont
/bin/showkey
/bin/unicode_start
/bin/unicode_stop
/bin/kbdrate
/bin/clrunimap
/bin/getunimap
/bin/outpsfheader
/bin/screendump
/bin/setlogcons
/bin/setpalette
/bin/setvesablank
/bin/spawn_console
/bin/spawn_login
%endif
%{_sbindir}/fbtest
%{_bindir}/chvt
%{_bindir}/openvt
%{_bindir}/deallocvt
%{_bindir}/dumpkeys
%ifnarch %{sparc} m68k
%{_bindir}/getkeycodes
%{_bindir}/setkeycodes
%endif
%{_bindir}/fgconsole
%{_bindir}/kbd_mode
%{_bindir}/kbdinfo
%{_bindir}/loadkeys
%{_bindir}/loadunimap
%{_bindir}/mapscrn
%{_bindir}/psfaddtable
%{_bindir}/psfgettable
%{_bindir}/psfstriptable
%{_bindir}/psfxtable
%ifarch %{ix86} x86_64
%{_bindir}/resizecons
%endif
%{_bindir}/setfont
%{_bindir}/setleds
%{_bindir}/setmetamode
%{_bindir}/setvtrgb
%{_bindir}/showconsolefont
%{_bindir}/showkey
%{_bindir}/unicode_start
%{_bindir}/unicode_stop
%{_bindir}/kbdrate
%{_bindir}/clrunimap
%{_bindir}/getunimap
%{_bindir}/outpsfheader
%{_bindir}/screendump
%{_bindir}/setlogcons
%{_bindir}/setpalette
%{_bindir}/setvesablank
%{_bindir}/spawn_console
%{_bindir}/spawn_login
%{_bindir}/vlock
%ifarch %{ix86} x86_64
%dir %{_libexecdir}/%{name}
%{_libexecdir}/%{name}/numlockbios
%endif
%{_mandir}/man1/*
%{_mandir}/man5/keymaps.5%{ext_man}
%ifnarch %{sparc} m68k
%{_mandir}/man8/getkeycodes.8%{ext_man}
%{_mandir}/man8/setkeycodes.8%{ext_man}
%endif
%{_mandir}/man8/showconsolefont.8%{ext_man}
%{_mandir}/man8/loadunimap.8%{ext_man}
%{_mandir}/man8/mapscrn.8%{ext_man}
%ifarch %{ix86} x86_64
%{_mandir}/man8/resizecons.8%{ext_man}
%endif
%{_mandir}/man8/setfont.8%{ext_man}
%{_mandir}/man8/fbtest.8%{ext_man}
%{_mandir}/man8/kbdrate.8%{ext_man}
%{_mandir}/man8/clrunimap.8%{ext_man}
%{_mandir}/man8/getunimap.8%{ext_man}
%{_mandir}/man8/mk_modmap.8%{ext_man}
%{_mandir}/man8/setlogcons.8%{ext_man}
%{_mandir}/man8/setvesablank.8%{ext_man}
%{_mandir}/man8/setvtrgb.8%{ext_man}
%{_mandir}/man8/vcstime.8%{ext_man}
%if %{defined _distconfdir}
%{_pam_vendordir}/vlock
%else
%config(noreplace) %{_sysconfdir}/pam.d/vlock
%endif
%dir %{_datadir}/systemd
%{_prefix}/lib/systemd/system/kbdsettings.service
%{_datadir}/systemd/kbd-model-map.xkb-generated
%{_sbindir}/kbdsettings
%files legacy
%{kbd}/keymaps/{%{legacy_folders}}
%changelog

BIN
kbd_fonts.tar.bz2 (Stored with Git LFS) Normal file

Binary file not shown.

55
kbdsettings Normal file
View File

@ -0,0 +1,55 @@
#! /bin/sh
. /etc/sysconfig/keyboard
[ $KBD_DELAY ] && /usr/bin/kbdrate -s -d $KBD_DELAY
[ $KBD_RATE ] && /usr/bin/kbdrate -s -r $KBD_RATE
for i in NUM SCR CAPS; do
conf=$(eval echo KBD_${i}LOCK)
eval confval=\"\$$conf\"
[ -z "$confval" ] && continue
param=$(echo $i | tr A-Z a-z | sed 's/scr/scroll/')
for tty in ${KBD_TTY:-tty1 tty2 tty3 tty4 tty5 tty6}; do
case "$confval" in
yes)
if [ $param = "num" ]; then
touch /run/numlock-on
fi
/usr/bin/setleds -D +$param < /dev/$tty
;;
no)
if [ $param = "num" ]; then
rm -f /run/numlock-on
fi
/usr/bin/setleds -D -$param < /dev/$tty
;;
bios)
if [ -x /usr/libexec/kbd/numlockbios ]; then
bios=$(/usr/libexec/kbd/numlockbios 2>/dev/null)
else
bios=$(/usr/lib/kbd/numlockbios 2>/dev/null)
fi
if [ $param = "num" ]; then
if [ "$bios" = "on" ]; then
touch /run/numlock-on
/usr/bin/setleds -D +$param < /dev/$tty
elif [ "$bios" = "off" -o "$bios" = "unknown" ]; then
rm -f /run/numlock-on
/usr/bin/setleds -D -$param < /dev/$tty
fi
else
echo "Value $confval invalid for $conf"
fi
;;
*)
echo "error: unknown value $confval in $conf"
;;
esac
done
done
if [ "$KBD_DISABLE_CAPS_LOCK" = "yes" ]; then
/usr/bin/dumpkeys | sed 's/ *58 *= *Caps_Lock/ 58 = Control/' | /usr/bin/loadkeys -q -
fi

19
kbdsettings-nox86.patch Normal file
View File

@ -0,0 +1,19 @@
--- a/sysconfig.keyboard
+++ b/sysconfig.keyboard
@@ -15,12 +15,12 @@
# Keyboard repeat rate (2.0 - 30.0)
KBD_RATE=""
-## Type: list(bios,yes,no)
-## Default: bios
+## Type: yesno
+## Default: no
#
-# NumLock on? ("yes" or "no" or "bios" for BIOS setting)
+# NumLock on? ("yes" or "no")
# This setting may interfere with GNOME /org/gnome/settings-daemon/peripherals/keyboard/remember-numlock-state DConf key.
-KBD_NUMLOCK="bios"
+KBD_NUMLOCK="no"
## Type: yesno
## Default: no

15
kbdsettings.service Normal file
View File

@ -0,0 +1,15 @@
[Unit]
Description=Apply settings from /etc/sysconfig/keyboard
After=basic.target
After=systemd-vconsole-setup.service
PartOf=systemd-vconsole-setup.service
ConditionPathExists=/etc/sysconfig/keyboard
ConditionPathExists=/dev/tty0
[Service]
Type=oneshot
ExecStart=/usr/sbin/kbdsettings
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

52
numlockbios.c Normal file
View File

@ -0,0 +1,52 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int main() {
#define BIOS_DATA_AREA 0x400
#define BDA_KEYBOARD_STATUS_FLAGS_4 0x97
#define BDA_KSF4_NUMLOCK_MASK 0x02
int fdmem;
char c;
errno=0;
fdmem = open("/dev/mem", O_RDONLY);
if (fdmem < 0) {
fprintf(stderr, "Couldn't open /dev/mem; %s\n", strerror(errno));
goto finish;
}
if (lseek(fdmem, BIOS_DATA_AREA + BDA_KEYBOARD_STATUS_FLAGS_4, SEEK_SET) == (off_t) -1) {
fprintf(stderr, "Failed to seek /dev/mem: %s\n", strerror(errno));
goto finish;
}
if (read (fdmem, &c, sizeof(char)) == -1) {
fprintf(stderr, "Failed to read /dev/mem: %s\n", strerror(errno));
goto finish;
}
if (c & BDA_KSF4_NUMLOCK_MASK)
printf("on\n");
else
printf("off\n");
finish:
close(fdmem);
if (errno)
{
printf("unknown\n");
exit(EXIT_FAILURE);
}
return 0;
}

26
repack_kbd.sh Normal file
View File

@ -0,0 +1,26 @@
#!/bin/sh
#
# repackage kbd source tar ball,
# to remove fonts that forbid commercial distribution.
#
# 2005-07-11, jw@suse.de
tmpdir=`mktemp -d`
in="$1"
if [ -z $in ]; then
echo "usage: $0 <tarball>"
exit 1
fi
name="${in%.tar.*}"
# recent gnu tar can autodetect gzip / bzip2
if ! tar xf "$in" -C $tmpdir; then
rm -rf $tmpdir
exit 1
fi
echo removing files...
find $tmpdir -iname \*agafari\* | tee /dev/tty | xargs rm
tar Jcf $name-repack.tar.xz -C $tmpdir $name
rm -rf $tmpdir

BIN
suse-add.tar.bz2 (Stored with Git LFS) Normal file

Binary file not shown.

49
sysconfig.console Normal file
View File

@ -0,0 +1,49 @@
## Path: Hardware/Console
## Description: Text console settings (see also Hardware/Keyboard)
#
## Type: string
## Default: ""
#
# Console settings.
# Note: The KBD_TTY setting from Hardware/Keyboard (sysconfig/keyboard)
# also applies for the settings here.
#
# Load this console font on bootup:
# (/usr/share/kbd/consolefonts/)
#
CONSOLE_FONT=""
## Type: string
## Default: ""
#
# Some fonts come without a unicode map.
# (.psfu fonts supposedly have it, others often not.)
# You can then specify the unicode mapping of your font
# explicitly. (/usr/share/kbd/unimaps/)
# Normally not needed.
#
CONSOLE_UNICODEMAP=""
## Type: string
## Default: ""
#
# Most programs output 8 bit characters, so you need a table to
# translate those characters into unicode. That one can be specified
# here. (/usr/share/kbd/consoletrans/)
# (Note: If your console is in utf-8 mode you don't need this.)
# If your code does not use a unicode mapping at all (because you
# e.g. explicitly specified UNICODEMAP="none") you may circumvent
# the translation via unicode, but load a map which directly maps
# 8 bit output of your program to a font position.
#
CONSOLE_SCREENMAP=""
## Type: string
## Default: ""
#
# for some fonts the console has to be initialized with CONSOLE_MAGIC.
# CONSOLE_MAGIC can be empty or have the values "(B", ")B", "(K" or ")K".
# Normally not needed (automatically handled by setfont).
#
CONSOLE_MAGIC=""

56
sysconfig.keyboard Normal file
View File

@ -0,0 +1,56 @@
## Path: Hardware/Keyboard
## Description: Keyboard settings for the text console
## ServiceRestart: kbdsettings
#
## Type: integer
## Default:
#
# Keyboard delay time in ms (250, 500, 750, 1000)
KBD_DELAY=""
## Type: string(2.0,2.1,2.3,2.5,2.7,3.0,3.3,3.7,4.0,4.3,4.6,5.0,5.5,6.0,6.7,7.5,8.0,8.6,9.2,10.0,10.9,12.0,13.3,15.0,16.0,17.1,18.5,20.0,21.8,24.0,26.7,30.0)
## Default:
#
# Keyboard repeat rate (2.0 - 30.0)
KBD_RATE=""
## Type: list(bios,yes,no)
## Default: bios
#
# NumLock on? ("yes" or "no" or "bios" for BIOS setting)
# This setting may interfere with GNOME /org/gnome/settings-daemon/peripherals/keyboard/remember-numlock-state DConf key.
KBD_NUMLOCK="bios"
## Type: yesno
## Default: no
#
# ScrollLock on? ("yes" or "no")
KBD_SCRLOCK="no"
## Type: yesno
## Default: no
#
# CapsLock on? ("yes" or "no")
KBD_CAPSLOCK="no"
## Type: yesno
## Default: no
#
# Disable CAPS LOCK and make it a normal Shift key?
# (Ctrl Caps Lock will still toggle Caps Lock functionality)
# Note that you need to tweak the xkb maps or use xmodmap
# if you want to do the same under X-Windows. In ~/.Xmodmap:
# keycode 0x42 = Shift_L Shift_L
#
KBD_DISABLE_CAPS_LOCK="no"
## Type: string
## Default:
#
# ttys for the above settings
# Example: "tty1 tty2"
# "" for tty's 1-6
#
KBD_TTY=""

5
vlock.pamd Normal file
View File

@ -0,0 +1,5 @@
#%PAM-1.0
auth include common-auth
account include common-account
password include common-password
session include common-session

231
xml2lst.pl Normal file
View File

@ -0,0 +1,231 @@
#!/usr/bin/perl
# converts the <rules>.xml file to the old format <rules>.lst file
#
# Usage:
#
# perl xml2lst.pl < filename.xml > filename.lst
#
# author Ivan Pascal
# modified by Vitezslav Crhonek
$doc = new_document( 0, '');
parse('', $doc);
($reg) = node_by_name($doc, '/xkbConfigRegistry');
@models = node_by_name($reg, 'modelList/model/configItem');
@layouts = node_by_name($reg, 'layoutList/layout/configItem');
@options = node_by_name($reg, 'optionList/group/configItem');
for $i (@layouts) {
($name) = node_by_name($i, 'name');
@variants = node_by_name($i, '../variantList/variant/configItem');
for $v (@variants) {
($variant) = node_by_name($v, 'name');
printf("%s %s\n", text_child($name), text_child($variant));
}
}
sub with_attribute {
local ($nodelist, $attrexpr) = @_;
local ($attr, $value) = split (/=/, $attrexpr);
local ($node, $attrvalue);
if (defined $value && $value ne '') {
$value =~ s/"//g;
foreach $node (@{$nodelist}) {
$attrvalue = node_attribute($node, $attr);
if (defined $attrvalue && $attrvalue eq $value) {
return $node;
}
}
} else {
foreach $node (@{$nodelist}) {
if (! defined node_attribute($node, $attr)) {
return $node;
}
}
}
undef;
}
# Subroutines
sub parse {
local $intag = 0;
my (@node_stack, $parent);
$parent = @_[1];
local ($tag, $text);
while (<>) {
chomp;
@str = split /([<>])/;
shift @str if ($str[0] eq '' || $str[0] =~ /^[ \t]*$/);
while (scalar @str) {
$token = shift @str;
if ($token eq '<') {
$intag = 1;
if (defined $text) {
add_text_node($parent, $text);
undef $text;
}
} elsif ($token eq '>') {
$intag = 0;
if ($tag =~ /^\/(.*)/) { # close tag
$parent = pop @node_stack;
} elsif ($tag =~ /^([^\/]*)\/$/) {
empty_tag($parent, $1);
} else {
if (defined ($node = open_tag($parent, $tag))) {
push @node_stack, $parent;
$parent = $node;
}
}
undef $tag;
} else {
if ($intag == 1) {
if (defined $tag) {
$tag .= ' '. $token;
} else {
$tag = $token;
}
} else {
if (defined $text) {
$text .= "\n" . $token;
} else {
$text = $token;
}
}
}
}
}
}
sub new_document {
$doc = new_node( 0, '', 'DOCUMENT');
$doc->{CHILDREN} = [];
return $doc;
}
sub new_node {
local ($parent_node, $tag, $type) = @_;
my %node;
$node{PARENT} = $parent_node;
$node{TYPE} = $type;
if ($type eq 'COMMENT' || $type eq 'TEXT') {
$node{TEXT} = $tag;
$node{NAME} = $type;
return \%node;
}
local ($tname, $attr) = split(' ', $tag, 2);
$node{NAME} = $tname;
if (defined $attr && $attr ne '') {
my %attr_table;
local @attr_list = split ( /"/, $attr);
local ($name, $value);
while (scalar @attr_list) {
$name = shift @attr_list;
$name =~ s/[ =]//g;
next if ($name eq '');
$value = shift @attr_list;
$attr_table{$name} =$value;
}
$node{ATTRIBUTES} = \%attr_table;
}
return \%node;
}
sub add_node {
local ($parent_node, $node) = @_;
push @{$parent_node->{CHILDREN}}, $node;
local $tname = $node->{NAME};
if (defined $parent_node->{$tname}) {
push @{$parent_node->{$tname}}, $node
} else {
$parent_node->{$tname} = [ $node ];
}
}
sub empty_tag {
local ($parent_node, $tag) = @_;
local $node = new_node($parent_node, $tag, 'EMPTY');
add_node($parent_node, $node);
}
sub open_tag {
local ($parent_node, $tag) = @_;
local $node;
if ($tag =~ /^\?.*/ || $tag =~ /^\!.*/) {
$node = new_node($parent_node, $tag, 'COMMENT');
add_node($parent_node, $node);
undef; return;
} else {
$node = new_node($parent_node, $tag, 'NODE');
$node->{CHILDREN} = [];
add_node($parent_node, $node);
return $node;
}
}
sub add_text_node {
local ($parent_node, $text) = @_;
local $node = new_node($parent_node, $text, 'TEXT');
add_node($parent_node, $node);
}
sub node_by_name {
local ($node, $name) = @_;
local ($tagname, $path) = split(/\//, $name, 2);
my @nodelist;
if ($tagname eq '') {
while ($node->{PARENT} != 0) {
$node = $node->{PARENT};
}
sublist_by_name($node, $path, \@nodelist);
} else {
sublist_by_name($node, $name, \@nodelist);
}
return @nodelist;
}
sub sublist_by_name {
local ($node, $name, $res) = @_;
local ($tagname, $path) = split(/\//, $name, 2);
if (! defined $path) {
push @{$res}, (@{$node->{$tagname}});
return;
}
if ($tagname eq '..' && $node->{PARENT} != 0) {
$node = $node->{PARENT};
sublist_by_name($node, $path, $res);
} else {
local $n;
for $n (@{$node->{$tagname}}) {
sublist_by_name($n, $path, $res);
}
}
}
sub node_attribute {
local $node = @_[0];
if (defined $node->{ATTRIBUTES}) {
return $node->{ATTRIBUTES}{@_[1]};
}
undef;
}
sub text_child {
local ($node) = @_;
local ($child) = node_by_name($node, 'TEXT');
return $child->{TEXT};
}