209 lines
5.5 KiB
Diff
209 lines
5.5 KiB
Diff
--- kbd-1.12/src/setfont.c.orig 2005-03-03 19:17:42.000000000 +0000
|
|
+++ kbd-1.12/src/setfont.c 2005-03-04 15:19:13.000000000 +0000
|
|
@@ -189,6 +189,20 @@
|
|
|
|
fd = getfd(console);
|
|
|
|
+ int kd_mode = -1;
|
|
+ if (!ioctl(fd, KDGETMODE, &kd_mode) && (kd_mode == KD_GRAPHICS))
|
|
+ {
|
|
+ /*
|
|
+ * PIO_FONT will fail on a console which is in foreground and in KD_GRAPHICS mode.
|
|
+ * 2005-03-03, jw@suse.de.
|
|
+ */
|
|
+ if (verbose)
|
|
+ printf("setfont: graphics console %s skipped\n", console?console:"");
|
|
+ close(fd);
|
|
+ return 0;
|
|
+ }
|
|
+
|
|
+
|
|
if (!ifilct && !mfil && !ufil &&
|
|
!Ofil && !ofil && !omfil && !oufil && !restore)
|
|
/* reset to some default */
|
|
--- kbd-1.12/src/kdfontop.c.orig 2005-03-03 19:14:27.000000000 +0000
|
|
+++ kbd-1.12/src/kdfontop.c 2005-03-03 19:42:28.000000000 +0000
|
|
@@ -7,6 +7,7 @@
|
|
#include <stdio.h>
|
|
#include <errno.h>
|
|
#include <stdlib.h> /* free() */
|
|
+#include <unistd.h> /* usleep() */
|
|
#include <sys/ioctl.h>
|
|
#include <linux/kd.h>
|
|
#include "kdfontop.h"
|
|
@@ -275,7 +276,19 @@
|
|
|
|
/* Third attempt: PIO_FONT */
|
|
/* This will load precisely 256 chars, independent of count */
|
|
- i = ioctl(fd, PIO_FONT, buf);
|
|
+ int loop = 0;
|
|
+
|
|
+ /* we allow ourselves to hang here for ca 5 seconds, xdm may be playing tricks on us. */
|
|
+ while ((loop++ < 20) && (i = ioctl(fd, PIO_FONT, buf)))
|
|
+ {
|
|
+ if (loop <= 1)
|
|
+ fprintf(stderr, "putfont: PIO_FONT trying ...\n");
|
|
+ else
|
|
+ fprintf(stderr, ".");
|
|
+ usleep(250000);
|
|
+ }
|
|
+ fprintf(stderr, "\n");
|
|
+
|
|
if (i) {
|
|
fprintf(stderr, "%s: putfont: %d,%dx%d: failed: %d\n", progname, count, width, height, i);
|
|
perror("putfont: PIO_FONT");
|
|
--- 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 '<cons1 cons2 ...>'
|
|
+|
|
|
+.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 <cons1,cons2,...>\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);
|