nanogui: Compiling nano-X (SVGAlib) under Linux Mandrake 8
Subject:
Re: [nanogui] Compiling nano-X (SVGAlib) under Linux Mandrake 8
From:
David Douthitt ####@####.####
Date:
29 Jun 2001 14:28:39 -0000
Message-Id: <3B3C8280.7C2322A2@mailbag.com>
Jordan Crouse wrote:
>
> First and foremost, what version are you trying to compile?
0.89pre7
I noticed that the directory in the tar.gz file is microwin; why not
microwin-0.89pre7?
> > 1. drivers/kbd_ttyscan.c - ioctl_setpalette() and ioctl_getpalette()
> > don't exist.
>
> This is in the VT switch code - These should be defined in drivers/fb.h
> which should be included in scr_fb.c. .89pre7 does indeed have this.
That does work, but fails during linking.
> However, drivers/kdb_ttyscan.c should have a #ifdef around the VT switching
> code. This compiles fine for me, though, so I don't know why the Makdrake
> compiler is getting angry.
ioctl_setpalette() and ioctl_getpalette don't have any #ifdef around
them.
> > 2. drivers/kbd_ttyscan.c - during running of nano-X, it produces:
> >
> > KDGKBMODE: Invalid argument
> > Cannot initialise keyboard
>
> /dev/tty is not really a device. - Why have we seen this so much lately? I
> just compiled .89pre7 and ran it on my Redhat 7.1 system with no problems.
> If so, then thats easily my mistake. I might have made an idiot mistake in
> the code somewhere....... :(
# ls -l /dev/tty
crw-rw-rw- 1 root root 5, 0 Jun 28 11:12 /dev/tty
I noticed in the code that there is no attempt to discern the actual
error; it just prints this message.
I also noticed in the man page for ioctl this description:
SYNOPSIS
#include <sys/ioctl.h>
int ioctl(int d, int request, ...)
[The "third" argument is traditionally char *argp, and will be so
named for this discussion.]
However, in the code, the usage is this:
static int fd; /* file descriptor for keyboard */
[...]
static int old_kbd_mode;
[...]
if (ioctl(fd, KDGKBMODE, &old_kbd_mode) < 0) {
perror("KDGKBMODE");
goto err;
}
[...with spelling error fixed...]
KDGKBMODE is defined in <linux/kd.h> as:
#define KDGKBMODE 0x4B44 /* gets current keyboard mode */
#define KDSKBMODE 0x4B45 /* sets current keyboard mode */
I wondered if changing old_kbd_mode thus wouldn't fix it, but it didn't:
static char old_kbd_mode;
...but that didn't fix it: and besides, wouldn't an oddball third
argument just generate a SegFault when you tried to write? When I tried
it, nothing changed.
In working on this, it became apparent that the same error is generated
for the following defines:
#define KDGETLED 0x4B31 /* return current led state */
#define KDSETLED 0x4B32 /* set led state [lights, not flags] */
Removing all calls to ioctl using KDGETLED, KDSETLED, KDSKBMODE, and
KDGKBMODE removes the first error ("invalid argument") but not the
second ("Cannot initialise keyboard"). This doesn't seem to be coming
from any of the code in drivers/* so I guess I don't understand it.
Also, I'm using:
# rpm -qf /usr/include/linux/kd.h
kernel-headers-2.4.3-20mdk
# rpm -q kernel glibc
kernel-2.4.3-20mdk
glibc-2.2.2-4mdk
# gcc -v
Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux/2.96/specs
gcc version 2.96 20000731 (Linux-Mandrake 8.0 2.96-0.48mdk)
#
> > ...also, the original kbd_ttyscan.c seems to have a typo in this error
> > message, as it doesn't match the ioctl call above it...
Here's the original:
/* Save previous settings*/
if (ioctl(fd, KDGKBMODE, &old_kbd_mode) < 0) {
perror("KDGKMODE");
goto err;
}
That is, KDGKMODE instead of KDGKBMODE ...