Package: kbd-chooser
Severity: important
Tags: patch l10n d-i
As explained in #276548 installing the keymap to /target when console is
in the unicode mode produces some side effects which directly effect
the Turkish keyboard. Could you please apply the patch attached which
incorporates a workaround for #276548?
Changelog:
* As a workaround to #276548, temporarily switch to ascii mode
before installing the Turkish keymap.
This patch includes a simple code change in kbd-mode which simplifies
similar workarounds. I've tested it enough and observed that it works.
No other keymaps other than Turkish will be affected by this patch.
Regards,
--
roktas
diff -ruN kbd-chooser.orig/debian/prebaseconfig kbd-chooser/debian/prebaseconfig
--- kbd-chooser.orig/debian/prebaseconfig 2004-04-19 05:13:49.000000000 +0300
+++ kbd-chooser/debian/prebaseconfig 2004-10-15 21:35:30.000000000 +0300
@@ -10,20 +10,38 @@
exit 0
fi
-# Install non-Unicode variants of Turkish keymaps
-if [ "$KEYMAP" = "trqu" ]; then
- KEYMAP="trq"
- db_set debian-installer/keymap $KEYMAP
-fi
-if [ "$KEYMAP" = "trfu" ]; then
- KEYMAP="trf"
- db_set debian-installer/keymap $KEYMAP
-fi
+case "$KEYMAP" in
+ trqu|trfu)
+ # Install non-Unicode variants of Turkish keymaps
+ if [ "$KEYMAP" = "trqu" ]; then
+ KEYMAP="trq"
+ elif [ "$KEYMAP" = "trfu" ]; then
+ KEYMAP="trf"
+ fi
+
+ # Switch to ascii mode when installing these keymaps
+ forced_mode="ascii"
+ db_set debian-installer/keymap $KEYMAP
+ ;;
+ *)
+ # Nothing to do.
+ ;;
+esac
db_get debian-installer/serial-console
if [ "$RET" = "false" ] ; then
apt-install console-tools console-data console-common
+
+ if [ -n "$forced_mode" ]; then
+ saved_mode=`kbd-mode`
+ kbd-mode --$forced_mode
+ fi
+
chroot /target install-keymap $KEYMAP
+
+ if [ -n "$saved_mode" ]; then
+ kbd-mode --$saved_mode
+ fi
fi
diff -ruN kbd-chooser.orig/kbd-mode.c kbd-chooser/kbd-mode.c
--- kbd-chooser.orig/kbd-mode.c 2004-07-04 20:05:15.000000000 +0300
+++ kbd-chooser/kbd-mode.c 2004-10-15 21:45:59.000000000 +0300
@@ -32,6 +32,12 @@
#define di_info(format...) di_log(DI_LOG_LEVEL_INFO, format)
#endif
+/* Descriptive names for keyboard modes. */
+#define S_XLATE "ascii"
+#define S_MEDIUMRAW "keycode"
+#define S_RAW "scancode"
+#define S_UNICODE "unicode"
+
extern int getfd (void);
static char *progname = "kbd-mode";
@@ -42,11 +48,11 @@
puts ("Report and set keyboard mode");
puts ("");
puts ("Options are:");
- puts ("-h --help print this help information and exit");
- puts ("-a --8bit ASCII or 8bit mode (XLATE)");
- puts ("-k --keycode keycode mode (MEDIUMRAW)");
- puts ("-u --unicode UTF-8 mode (UNICODE)");
- puts ("-s --scancode scancode mode (RAW)");
+ puts ("-h --help" "\tprint this help information and exit");
+ puts ("-a --" S_XLATE "\tascii or 8bit mode (XLATE)");
+ puts ("-k --" S_MEDIUMRAW "\tkeycode mode (MEDIUMRAW)");
+ puts ("-s --" S_RAW "\tscancode mode (RAW)");
+ puts ("-u --" S_UNICODE "\tunicode mode (UNICODE)");
}
static int parse_cmdline (int argc, char *argv[])
@@ -55,12 +61,11 @@
int c;
const struct option long_opts[] = {
{ "help" , no_argument, NULL, 'h' },
- { "8bit" , no_argument, NULL, 'a' },
- { "ascii" , no_argument, NULL, 'a' },
- { "keycode" , no_argument, NULL, 'k' },
- { "scancode" , no_argument, NULL, 's' },
- { "unicode" , no_argument, NULL, 'u' },
- { NULL, 0, NULL, 0 }
+ { S_XLATE , no_argument, NULL, 'a' },
+ { S_MEDIUMRAW, no_argument, NULL, 'k' },
+ { S_RAW , no_argument, NULL, 's' },
+ { S_UNICODE , no_argument, NULL, 'u' },
+ { NULL , 0, NULL, 0 }
};
mode = -1;
@@ -68,19 +73,22 @@
switch (c) {
case 'h':
usage ();
- exit(0);
+ exit (0);
case 'a':
mode = K_XLATE;
break;
- case 'u':
- mode = K_UNICODE;
+ case 'k':
+ mode = K_MEDIUMRAW;
break;
case 's':
mode = K_RAW;
break;
- case 'k':
- mode = K_MEDIUMRAW;
+ case 'u':
+ mode = K_UNICODE;
break;
+ default:
+ di_error ("%s: error parsing command line\n", progname);
+ exit (1);
}
return mode;
@@ -89,16 +97,16 @@
static const char *desc (int mode)
{
switch (mode) {
- case K_RAW:
- return "raw (scancode)";
- case K_MEDIUMRAW:
- return "mediumraw (keycode)";
case K_XLATE:
- return "ASCII (default)";
+ return S_XLATE;
+ case K_MEDIUMRAW:
+ return S_MEDIUMRAW;
+ case K_RAW:
+ return S_RAW;
case K_UNICODE:
- return "Unicode (UTF-8)";
+ return S_UNICODE;
default:
- return "unknown";
+ return NULL;
}
}
@@ -111,14 +119,23 @@
fd = getfd ();
- /* Report console mode. */
+ /*
+ * Report console mode in a way so that it can
+ * be used later as a command line option.
+ */
if (mode == -1) {
+ const char *mode_str;
+
if (ioctl (fd, KDGKBMODE, &mode)) {
di_error ("%s: error reading console mode\n", progname);
exit (1);
}
- printf ("Console mode: %s\n", desc (mode));
+ mode_str = desc (mode);
+ if (! mode_str)
+ di_info ("%s: unknown console mode reported\n", progname);
+ else
+ printf ("%s\n", mode_str);
exit (0);
}
Attachment:
signature.asc
Description: Digital signature