diff --git a/kbd-1.12-dumpkeys-C-opt.diff b/kbd-1.12-dumpkeys-C-opt.diff new file mode 100644 index 0000000..fe17c77 --- /dev/null +++ b/kbd-1.12-dumpkeys-C-opt.diff @@ -0,0 +1,78 @@ +--- man/man1/dumpkeys.1.in ++++ man/man1/dumpkeys.1.in 2008-06-04 18:26:00.885947236 +0200 +@@ -4,6 +4,7 @@ + dumpkeys \- dump keyboard translation tables + .SH SYNOPSIS + .B dumpkeys ++.RI [ \-C\ '' | \-\-console='' ] + [ + .B \-hilfn + .BI \-c charset +@@ -197,6 +198,12 @@ This option produces an output line `cha + loadkeys how to interpret the keymap. (For example, "division" is + 0xf7 in iso-8859-1 but 0xba in iso-8859-8.) + .LP ++The affected console device can be specified using the ++.I -C ++(or ++.I --console ++) option. This option supports exactly one device name. ++.LP + .SH FILES + .PD 0 + .TP 20 +--- src/dumpkeys.c ++++ src/dumpkeys.c 2008-06-04 18:20:51.762445784 +0200 +@@ -31,6 +31,7 @@ + static int fd; + static int verbose; + static int nr_keys = 0; /* probably 112, 128, 256 or 512 */ ++static char * console; + + int keymap_index[MAX_NR_KEYMAPS]; /* inverse of good_keymap */ + int good_keymap[MAX_NR_KEYMAPS], keymapnr, allocct; +@@ -560,6 +561,8 @@ valid options are:\n\ + --funcs-only display only the function key strings\n\ + --keys-only display only key bindings\n\ + --compose-only display only compose key combinations\n\ ++ -C \n\ ++ --console= Indicate the virtual console device to be used.\n\ + -c --charset=")); + list_charsets(stderr); + fprintf(stderr, _("\ +@@ -571,7 +574,7 @@ valid options are:\n\ + + int + main (int argc, char *argv[]) { +- const char *short_opts = "hilvsnf1S:c:V"; ++ const char *short_opts = "hilvsnf1S:c:C:V"; + const struct option long_opts[] = { + { "help", no_argument, NULL, 'h' }, + { "short-info", no_argument, NULL, 'i' }, +@@ -584,6 +587,7 @@ main (int argc, char *argv[]) { + { "keys-only", no_argument, NULL, 'k' }, + { "compose-only",no_argument, NULL, 'd' }, + { "charset", required_argument, NULL, 'c' }, ++ { "console", required_argument, NULL, 'C' }, + { "verbose", no_argument, NULL, 'v' }, + { "version", no_argument, NULL, 'V' }, + { NULL, 0, NULL, 0 } +@@ -642,6 +646,9 @@ main (int argc, char *argv[]) { + usage(); + printf("charset \"%s\"\n", optarg); + break; ++ case 'C': ++ console = optarg; ++ break; + case 'V': + print_version_and_exit(); + case 'h': +@@ -653,7 +660,7 @@ main (int argc, char *argv[]) { + if (optind < argc) + usage(); + +- fd = getfd(NULL); ++ fd = getfd(console); + + find_nr_keys(); + diff --git a/kbd.changes b/kbd.changes index 7eda817..70aee75 100644 --- a/kbd.changes +++ b/kbd.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Jun 4 18:53:46 CEST 2008 - werner@suse.de + +- Add "-C" option also to dumpkeys to make kbd init script work on + /dev/console and /dev/tty even within e.g. xterm (bnc#337238) + ------------------------------------------------------------------- Mon May 19 12:39:16 CEST 2008 - jw@suse.de diff --git a/kbd.init b/kbd.init index 25c423a..7bd341a 100644 --- a/kbd.init +++ b/kbd.init @@ -95,10 +95,11 @@ for tty in $KBD_TTY_DEFAULT; do test -c /dev/$tty || continue > /dev/$tty &> /dev/null || continue # consider settings in /etc/sysconfig/keyboard:KBD_TTY - if test -n "$KBD_TTY"; then - echo "$KBD_TTY" | grep -q $tty || continue - fi - newkbd="${newkbd:+$newkbd }/dev/$tty" + test -z "$KBD_TTY" && continue + case ":${KBD_TTY// /:}:" in + *:$tty:*) + newkbd="${newkbd:+$newkbd }/dev/$tty" + esac done KBD_TTY="$newkbd" unset newkbd @@ -161,9 +162,16 @@ function set_kbdrate () if test -n "$KBD_DELAY"; then KBDOPT="${KBDOPT:+$KBDOPT }-d $KBD_DELAY" fi - if test -n "$KBDOPT" ; then + if test -n "$KBDOPT" -a -x /bin/kbdrate ; then echo -n "Keyboard: " - /bin/kbdrate $KBDOPT + for tty in $KBD_TTY; do + /bin/kbdrate $KBDOPT < $tty 2> /dev/null + rc_status + case "$KBDOPT" in + *-s*) continue ;; + esac + KBDOPT="${KBDOPT:+$KBDOPT }-s" + done rc_status -v1 fi fi @@ -446,32 +454,39 @@ case "$1" in case "$RUNLEVEL" in S|N|1|\#) true ;; *) + trap "rm -f /dev/shm/defkeymap.map" EXIT SIGTERM + if test -n "$KBD_TTY" ; then + dumpkeys -C ${KBD_TTY%% *} + else + dumpkeys + fi > /dev/shm/defkeymap.map + case $LOCALE_CHARMAP in UTF-8) # Change the keyboard mapping in such a way that the # non-ASCII keys produce UTF-8 encoded multibyte sequences # instead of single bytes >= 0x80 in a legacy 8-bit encoding. - ( dumpkeys | loadkeys -C "$KBD_TTY" --unicode ) > /dev/null 2>&1 + loadkeys -C "$KBD_TTY" --unicode /dev/shm/defkeymap.map > /dev/null 2>&1 ;; *) ;; esac - dumpkeys=yes - if type -p cmp > /dev/null 2>&1 && \ - dumpkeys | cmp -s /etc/defkeymap.map + + if type -p cmp > /dev/null 2>&1 && cmp -s /etc/defkeymap.map /dev/shm/defkeymap.map then - dumpkeys=no + rm -f /dev/shm/defkeymap.map fi - if test "$dumpkeys" = "yes" ; then + if test -s /dev/shm/defkeymap.map ; then # FIXME: this should be done much earlier # to avoid bugzilla# 259694 or similar. - ( dumpkeys > /etc/defkeymap.map ) > /dev/null 2>&1 + mv /dev/shm/defkeymap.map /etc/defkeymap.map if test ! -z "$KEYMAP" && test "$KEYMAP" != "/etc/defkeymap.map" ; then test ! -e "$KEYMAP" && KEYMAP=$K echo $KEYMAP > /etc/defkeymap.name fi fi + trap - EXIT SIGTERM esac ;; diff --git a/kbd.spec b/kbd.spec index 2282178..74f5f00 100644 --- a/kbd.spec +++ b/kbd.spec @@ -17,7 +17,7 @@ License: GPL v2 or later Group: System/Console AutoReqProv: on Version: 1.12 -Release: 182 +Release: 186 Summary: Keyboard and Font Utilities Source: ftp://ftp.win.tue.nl/pub/home/aeb/linux-local/utils/kbd/%{name}-%{version}.tar.bz2 Source1: kbd_fonts.tar.bz2 @@ -61,6 +61,7 @@ Patch25: sv-latin1-keycode10.diff Patch26: kbd-%{version}-setfont-no-cruft.diff Patch27: kbd-%{version}-be-nice-to-kdm.diff Patch28: bnc147581_jp106.diff +Patch29: kbd-%{version}-dumpkeys-C-opt.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build PreReq: %fillup_prereq %insserv_prereq BuildRequires: bison flex @@ -117,6 +118,7 @@ Authors: %patch26 -p1 # %patch27 -p1 # obsoleted. #302010 %patch28 -p1 +%patch29 -p0 %build for i in `find data/keymaps/mac -type f` ; do @@ -334,6 +336,9 @@ rm -rf $RPM_BUILD_ROOT #rm -rf $RPM_BUILD_DIR/kbd-%{version} %changelog +* Wed Jun 04 2008 werner@suse.de +- Add "-C" option also to dumpkeys to make kbd init script work on + /dev/console and /dev/tty even within e.g. xterm (bnc#337238) * Mon May 19 2008 jw@suse.de - added ru1_win-utf.map fixing bnc#337238 * Wed May 07 2008 werner@suse.de