--- kbd-1.12/man/man1/loadkeys.1.in.orig 2005-03-04 19:10:30.000000000 +0000 +++ kbd-1.12/man/man1/loadkeys.1.in 2005-03-04 19:11:13.000000000 +0000 @@ -7,6 +7,10 @@ [ .I -c --clearcompose ] [ +.I -C '' +| +.I --console=cons1,cons2,... +] [ .I -d --default ] [ .I -h --help @@ -28,6 +32,11 @@ reads the file or files specified by .IR filename... . Its main purpose is to load the kernel keymap for the console. +The affected console device or devices can be specified using the +.I -C +(or +.I --console +) option. This option supports a list of device names .SH "RESET TO DEFAULT" If the .I -d --- kbd-1.12/src/loadkeys.y.orig 2005-03-08 17:55:08.000000000 +0000 +++ kbd-1.12/src/loadkeys.y 2005-03-08 17:10:06.000000000 +0000 @@ -62,7 +62,7 @@ static void compose(int diacr, int base, int res); static void do_constant(void); static void do_constant_key (int, u_short); -static void loadkeys(void); +static void loadkeys(char *console, int *warned); static void mktable(void); static void strings_as_usual(void); static void keypad_as_usual(char *keyboard); @@ -250,6 +250,8 @@ "valid options are:\n" "\n" " -c --clearcompose clear kernel compose table\n" +" -C \n" +" --console=<...> Indicate console device(s) to be used.\n" " -d --default load \"" DEFMAP "\"\n" " -h --help display this help text\n" " -m --mktable output a \"defkeymap.c\" to stdout\n" @@ -269,9 +271,10 @@ int main(unsigned int argc, char *argv[]) { - const char *short_opts = "cdhmsuqvV"; + const char *short_opts = "cC:dhmsuqvV"; const struct option long_opts[] = { { "clearcompose", no_argument, NULL, 'c' }, + { "console", 1, NULL, 'C' }, { "default", no_argument, NULL, 'd' }, { "help", no_argument, NULL, 'h' }, { "mktable", no_argument, NULL, 'm' }, @@ -283,6 +286,8 @@ { NULL, 0, NULL, 0 } }; int c; + char *console = NULL; + int warned = 0; set_progname(argv[0]); @@ -292,6 +297,9 @@ case 'c': nocompose = 1; break; + case 'C': + console = optarg; + break; case 'd': optd = 1; break; @@ -330,8 +338,26 @@ do_constant(); if(optm) mktable(); + else if (console) + { + char *buf = strdup(console); /* make writable */ + char *e, *s = buf; + while (*s) + { + while ( *s == ' ' || *s == '\t' || *s == ',') s++; + e = s; + while (*e && *e != ' ' && *e != '\t' && *e != ',') e++; + char c = *e; + *e = '\0'; + if (verbose) printf("%s\n", s); + loadkeys(s, &warned); + *e = c; + s = e; + } + free(buf); + } else - loadkeys(); + loadkeys(NULL, &warned); exit(0); } @@ -760,7 +786,7 @@ } static int -defkeys(int fd) { +defkeys(int fd, char *cons, int *warned) { struct kbentry ke; int ct = 0; int i,j,fail; @@ -845,9 +871,21 @@ fprintf(stderr, _("%s: failed to restore keyboard mode\n"), progname); } - fprintf(stderr, _("%s: warning: this map uses Unicode symbols\n" - " (perhaps you want to do `kbd_mode -u'?)\n"), - progname); + + if (!warned++) + { + int kd_mode = -1; + if (ioctl(fd, KDGETMODE, &kd_mode) || (kd_mode != KD_GRAPHICS)) + { + /* + * It is okay for the graphics console to have a non-unicode mode. + * only talk about other consoles + */ + fprintf(stderr, _("%s: warning: this map uses Unicode symbols, %s mode=%d\n" + " (perhaps you want to do `kbd_mode -u'?)\n"), + progname, cons ? cons : "NULL", kd_mode); + } + } } return ct; } @@ -981,12 +1019,12 @@ } static void -loadkeys (void) { +loadkeys (char *console, int *warned) { int fd; int keyct, funcct, diacct; - fd = getfd(NULL); - keyct = defkeys(fd); + fd = getfd(console); + keyct = defkeys(fd, console, &warned); funcct = deffuncs(fd); if (accent_table_size > 0 || nocompose) diacct = defdiacs(fd);