--- 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 #include #include /* free() */ +#include /* usleep() */ #include #include #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");