diff options
Diffstat (limited to 'hw/xfree86/os-support/linux')
-rw-r--r-- | hw/xfree86/os-support/linux/int10/linux.c | 22 | ||||
-rw-r--r-- | hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c | 4 | ||||
-rw-r--r-- | hw/xfree86/os-support/linux/lnx.h | 2 | ||||
-rw-r--r-- | hw/xfree86/os-support/linux/lnxResource.c | 13 | ||||
-rw-r--r-- | hw/xfree86/os-support/linux/lnx_KbdMap.c | 2 | ||||
-rw-r--r-- | hw/xfree86/os-support/linux/lnx_agp.c | 10 | ||||
-rw-r--r-- | hw/xfree86/os-support/linux/lnx_apm.c | 2 | ||||
-rw-r--r-- | hw/xfree86/os-support/linux/lnx_axp.c | 2 | ||||
-rw-r--r-- | hw/xfree86/os-support/linux/lnx_ev56.c | 2 | ||||
-rw-r--r-- | hw/xfree86/os-support/linux/lnx_init.c | 78 | ||||
-rw-r--r-- | hw/xfree86/os-support/linux/lnx_io.c | 16 | ||||
-rw-r--r-- | hw/xfree86/os-support/linux/lnx_jstk.c | 2 | ||||
-rw-r--r-- | hw/xfree86/os-support/linux/lnx_kbd.c | 17 | ||||
-rw-r--r-- | hw/xfree86/os-support/linux/lnx_kbd.h | 2 | ||||
-rw-r--r-- | hw/xfree86/os-support/linux/lnx_kmod.c | 2 | ||||
-rw-r--r-- | hw/xfree86/os-support/linux/lnx_mouse.c | 175 | ||||
-rw-r--r-- | hw/xfree86/os-support/linux/lnx_pci.c | 2 | ||||
-rw-r--r-- | hw/xfree86/os-support/linux/lnx_video.c | 2 |
18 files changed, 68 insertions, 287 deletions
diff --git a/hw/xfree86/os-support/linux/int10/linux.c b/hw/xfree86/os-support/linux/int10/linux.c index 984c79122..4779899e4 100644 --- a/hw/xfree86/os-support/linux/int10/linux.c +++ b/hw/xfree86/os-support/linux/int10/linux.c @@ -1,7 +1,7 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.32 2004/02/05 18:24:59 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.30 2003/03/14 13:46:06 tsi Exp $ */ /* * linux specific part of the int10 module - * Copyright 1999, 2000, 2001, 2002, 2003, 2004 Egbert Eich + * Copyright 1999 Egbert Eich */ #include "xf86.h" #include "xf86_OSproc.h" @@ -212,9 +212,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) } else ((linuxInt10Priv*)pInt->private)->base_high = NULL; - if (!MapCurrentInt10(pInt)) - goto error3; - + MapCurrentInt10(pInt); Int10Current = pInt; #ifdef DEBUG @@ -240,7 +238,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) for (cs = V_BIOS; cs < SYS_BIOS; cs += V_BIOS_SIZE) if (xf86ReadBIOS(cs, 0, (pointer)cs, V_BIOS_SIZE) < V_BIOS_SIZE) xf86DrvMsg(screen, X_WARNING, - "Unable to retrieve all of segment 0x%06lX.\n", cs); + "Unable to retrieve all of segment 0x%06X.\n", cs); #ifdef DEBUG ErrorF("done\n"); #endif @@ -252,13 +250,13 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) && !(initPrimary(options))) { if (bios.bus == BUS_ISA && bios.location.legacy) { xf86DrvMsg(screen, X_CONFIG, - "Overriding BIOS location: 0x%x\n", + "Overriding BIOS location: 0x%lx\n", bios.location.legacy); cs = bios.location.legacy >> 4; bios_base = (unsigned char *)(cs << 4); if (!int10_check_bios(screen, cs, bios_base)) { xf86DrvMsg(screen, X_ERROR, - "No V_BIOS at specified address 0x%lx\n",cs << 4); + "No V_BIOS at specified address 0x%x\n",cs << 4); goto error3; } } else { @@ -288,7 +286,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) } } - xf86DrvMsg(screen, X_INFO, "Primary V_BIOS segment is: 0x%lx\n", cs); + xf86DrvMsg(screen, X_INFO, "Primary V_BIOS segment is: 0x%x\n", cs); pInt->BIOSseg = cs; set_return_trap(pInt); @@ -347,7 +345,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) bios_base = (unsigned char *)(cs << 4); if (!int10_check_bios(screen, cs, bios_base)) { xf86DrvMsg(screen,X_ERROR,"No V_BIOS found " - "on override address %p\n",bios_base); + "on override address 0x%x\n",bios_base); goto error3; } } else { @@ -367,7 +365,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) } } } - xf86DrvMsg(screen,X_INFO,"Primary V_BIOS segment is: 0x%lx\n",cs); + xf86DrvMsg(screen,X_INFO,"Primary V_BIOS segment is: 0x%x\n",cs); pInt->BIOSseg = cs; break; default: @@ -389,7 +387,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) return pInt; error4: - xf86DrvMsg(screen, X_ERROR, "shmat() call returned errno %d\n", errno); + xf86DrvMsg(screen, X_ERROR, "shmat() call retruned errno %d\n", errno); error3: if (base_high) shmdt(base_high); diff --git a/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c b/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c index e9cb6125a..6203cc3c3 100644 --- a/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c +++ b/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c @@ -1,5 +1,3 @@ -/* $XFree86$ */ - #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" @@ -175,7 +173,7 @@ vm86_GP_fault(xf86Int10InfoPtr pInt) case 0x0f: xf86DrvMsg(pInt->scrnIndex, X_ERROR, - "CPU 0x0f Trap at CS:EIP=0x%4.4x:0x%8.8lx\n", X86_CS, X86_EIP); + "CPU 0x0f Trap at CS:EIP=0x%4.4x:0x%8.8x\n", X86_CS, X86_EIP); goto op0ferr; default: diff --git a/hw/xfree86/os-support/linux/lnx.h b/hw/xfree86/os-support/linux/lnx.h index b2adcd514..f2dd16267 100644 --- a/hw/xfree86/os-support/linux/lnx.h +++ b/hw/xfree86/os-support/linux/lnx.h @@ -1,4 +1,4 @@ -/* $XFree86: Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx.h,v 3.3 2002/11/25 14:05:04 eich Exp $ */ #ifndef LNX_H_ # ifdef __alpha__ diff --git a/hw/xfree86/os-support/linux/lnxResource.c b/hw/xfree86/os-support/linux/lnxResource.c index 25ef8cc91..04e2f07c0 100644 --- a/hw/xfree86/os-support/linux/lnxResource.c +++ b/hw/xfree86/os-support/linux/lnxResource.c @@ -190,8 +190,7 @@ xf86AccResFromOS(resPtr ret) defined(__s390__) || \ defined(__hppa__) - /* - * XXX this isn't exactly correct but it will get the server working + /* XXX this isn't exactly correct but it will get the server working * for now until we get something better. */ @@ -204,7 +203,7 @@ xf86BusAccWindowsFromOS(void) RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); -#if defined(__sparc__) || defined(__powerpc__) +#ifdef __sparc__ RANGE(range, 0x00000000, 0x00ffffff, ResExcIoBlock); #else RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock); @@ -222,7 +221,7 @@ xf86PciBusAccWindowsFromOS(void) RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); -#if defined(__sparc__) || defined(__powerpc__) +#ifdef __sparc__ RANGE(range, 0x00000000, 0x00ffffff, ResExcIoBlock); #else RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock); @@ -231,7 +230,7 @@ xf86PciBusAccWindowsFromOS(void) return ret; } -#ifdef INCLUDE_UNUSED +#ifdef INCLUDE_UNUSED */ resPtr xf86IsaBusAccWindowsFromOS(void) @@ -242,7 +241,7 @@ xf86IsaBusAccWindowsFromOS(void) RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); -#if defined(__sparc__) || defined(__powerpc__) +#ifdef __sparc__ RANGE(range, 0x00000000, 0x00ffffff, ResExcIoBlock); #else RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock); @@ -268,7 +267,7 @@ xf86AccResFromOS(resPtr ret) ret = xf86AddResToList(ret, &range, -1); RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock); ret = xf86AddResToList(ret, &range, -1); -#if defined(__sparc__) || defined(__powerpc__) +#ifdef __sparc__ RANGE(range, 0x00ffffff, 0x00ffffff, ResExcIoBlock); #else RANGE(range, 0x0000ffff, 0x0000ffff, ResExcIoBlock); diff --git a/hw/xfree86/os-support/linux/lnx_KbdMap.c b/hw/xfree86/os-support/linux/lnx_KbdMap.c index 993679d81..25639d72d 100644 --- a/hw/xfree86/os-support/linux/lnx_KbdMap.c +++ b/hw/xfree86/os-support/linux/lnx_KbdMap.c @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_KbdMap.c,v 1.1 2002/10/11 01:40:35 dawes Exp $ */ /* * Slightly modified xf86KbdLnx.c which is diff --git a/hw/xfree86/os-support/linux/lnx_agp.c b/hw/xfree86/os-support/linux/lnx_agp.c index 58f1062da..05e299b11 100644 --- a/hw/xfree86/os-support/linux/lnx_agp.c +++ b/hw/xfree86/os-support/linux/lnx_agp.c @@ -263,14 +263,14 @@ xf86BindGARTMemory(int screenNum, int key, unsigned long offset) if (offset % AGP_PAGE_SIZE != 0) { xf86DrvMsg(screenNum, X_WARNING, "xf86BindGARTMemory: " - "offset (0x%lx) is not page-aligned (%d)\n", + "offset (0x%x) is not page-aligned (%d)\n", offset, AGP_PAGE_SIZE); return FALSE; } pageOffset = offset / AGP_PAGE_SIZE; xf86DrvMsgVerb(screenNum, X_INFO, 3, - "xf86BindGARTMemory: bind key %d at 0x%08lx " + "xf86BindGARTMemory: bind key %d at 0x%08x " "(pgoffset %d)\n", key, offset, pageOffset); bind.pg_start = pageOffset; @@ -279,7 +279,7 @@ xf86BindGARTMemory(int screenNum, int key, unsigned long offset) if (ioctl(gartFd, AGPIOC_BIND, &bind) != 0) { xf86DrvMsg(screenNum, X_WARNING, "xf86BindGARTMemory: " "binding of gart memory with key %d\n" - "\tat offset 0x%lx failed (%s)\n", + "\tat offset 0x%x failed (%s)\n", key, offset, strerror(errno)); return FALSE; } @@ -332,8 +332,8 @@ xf86EnableAGP(int screenNum, CARD32 mode) setup.agp_mode = mode; if (ioctl(gartFd, AGPIOC_SETUP, &setup) != 0) { xf86DrvMsg(screenNum, X_WARNING, "xf86EnableAGP: " - "AGPIOC_SETUP with mode %ld failed (%s)\n", - (unsigned long)mode, strerror(errno)); + "AGPIOC_SETUP with mode %d failed (%s)\n", + mode, strerror(errno)); return FALSE; } diff --git a/hw/xfree86/os-support/linux/lnx_apm.c b/hw/xfree86/os-support/linux/lnx_apm.c index 1f9142a6b..f2f326959 100644 --- a/hw/xfree86/os-support/linux/lnx_apm.c +++ b/hw/xfree86/os-support/linux/lnx_apm.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c,v 3.12 2001/12/24 22:54:31 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c,v 3.13 2002/10/16 01:24:28 dawes Exp $ */ #include "X.h" #include "os.h" diff --git a/hw/xfree86/os-support/linux/lnx_axp.c b/hw/xfree86/os-support/linux/lnx_axp.c index 106aa2804..5813ef4e9 100644 --- a/hw/xfree86/os-support/linux/lnx_axp.c +++ b/hw/xfree86/os-support/linux/lnx_axp.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c,v 1.3 2001/02/15 11:03:56 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c,v 1.5 2002/11/25 14:05:04 eich Exp $ */ #include <stdio.h> #include "X.h" diff --git a/hw/xfree86/os-support/linux/lnx_ev56.c b/hw/xfree86/os-support/linux/lnx_ev56.c index 8381fec27..bfcb0d70f 100644 --- a/hw/xfree86/os-support/linux/lnx_ev56.c +++ b/hw/xfree86/os-support/linux/lnx_ev56.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_ev56.c,v 3.5 2000/02/17 13:45:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_ev56.c,v 3.7 2002/11/25 14:05:04 eich Exp $ */ #include "X.h" #include "input.h" diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c index ea305e38d..0ac8c6a8b 100644 --- a/hw/xfree86/os-support/linux/lnx_init.c +++ b/hw/xfree86/os-support/linux/lnx_init.c @@ -1,4 +1,3 @@ -/* $XdotOrg: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c,v 3.15 2003/12/02 20:45:13 dawes Exp $ */ /* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c,v 3.14 2001/10/31 22:50:30 tsi Exp $ */ /* * Copyright 1992 by Orest Zborowski <obz@Kodak.com> @@ -8,19 +7,19 @@ * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Orest Zborowski and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of + * documentation, and that the names of Orest Zborowski and David Wexelblat + * not be used in advertising or publicity pertaining to distribution of * the software without specific, written prior permission. Orest Zborowski - * and David Wexelblat make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or + * and David Wexelblat make no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or * implied warranty. * - * OREST ZBOROWSKI AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL OREST ZBOROWSKI OR DAVID WEXELBLAT BE LIABLE - * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OREST ZBOROWSKI AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD + * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL OREST ZBOROWSKI OR DAVID WEXELBLAT BE LIABLE + * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ @@ -36,8 +35,6 @@ #include "xf86_OSlib.h" #include "lnx.h" -#include <sys/stat.h> - #ifdef USE_DEV_FB extern char *getenv(const char *); #include <linux/fb.h> @@ -48,44 +45,13 @@ static Bool KeepTty = FALSE; static int VTnum = -1; static int activeVT = -1; -static int vtPermSave[4]; -static char vtname[11]; - -static int -saveVtPerms(void) -{ - /* We need to use stat to get permissions. */ - struct stat svtp; - - /* Do them numerically ordered, hard coded tty0 first. */ - if (stat("/dev/tty0", &svtp) != 0) - return 0; - vtPermSave[0] = (int)svtp.st_uid; - vtPermSave[1] = (int)svtp.st_gid; - - /* Now check the console we are dealing with. */ - if (stat(vtname, &svtp) != 0) - return 0; - vtPermSave[2] = (int)svtp.st_uid; - vtPermSave[3] = (int)svtp.st_gid; - - return 1; -} - -static void -restoreVtPerms(void) -{ - /* Set the terminal permissions back to before we started. */ - chown("/dev/tty0", vtPermSave[0], vtPermSave[1]); - chown(vtname, vtPermSave[2], vtPermSave[3]); -} - void xf86OpenConsole(void) { int i, fd = -1; int result; struct vt_mode VT; + char vtname[11]; struct vt_stat vts; MessageType from = X_PROBED; #ifdef USE_DEV_FB @@ -95,7 +61,7 @@ xf86OpenConsole(void) char *tty0[] = { "/dev/tty0", "/dev/vc/0", NULL }; char *vcs[] = { "/dev/vc/%d", "/dev/tty%d", NULL }; - if (serverGeneration == 1) + if (serverGeneration == 1) { /* check if we're run with euid==0 */ if (geteuid() != 0) @@ -158,15 +124,6 @@ xf86OpenConsole(void) xf86Info.vtno, strerror(errno)); } - /* - * Grab the vt ownership before we overwrite it. - * Hard coded /dev/tty0 into this function as well for below. - */ - if (!saveVtPerms()){ - xf86Msg(X_WARNING, - "xf86OpenConsole: Could not save ownership of VT\n"); - } - /* change ownership of the vt */ chown(vtname, getuid(), getgid()); @@ -214,7 +171,7 @@ xf86OpenConsole(void) xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n"); } SYSCALL(result = ioctl(xf86Info.consoleFd, VT_GETMODE, &VT)); - if (result < 0) + if (result < 0) { FatalError("xf86OpenConsole: VT_GETMODE failed\n"); } @@ -224,7 +181,7 @@ xf86OpenConsole(void) VT.mode = VT_PROCESS; VT.relsig = SIGUSR1; VT.acqsig = SIGUSR1; - if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0) + if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0) { FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n"); } @@ -245,7 +202,7 @@ xf86OpenConsole(void) close(fbfd); #endif } - else + else { /* serverGeneration != 1 */ /* @@ -290,9 +247,6 @@ xf86CloseConsole() activeVT = -1; } close(xf86Info.consoleFd); /* make the vt-manager happy */ - - restoreVtPerms(); /* restore the permissions */ - return; } @@ -300,7 +254,7 @@ int xf86ProcessArgument(int argc, char *argv[], int i) { /* - * Keep server from detaching from controlling tty. This is useful + * Keep server from detaching from controlling tty. This is useful * when debugging (so the server can receive keyboard signals. */ if (!strcmp(argv[i], "-keeptty")) diff --git a/hw/xfree86/os-support/linux/lnx_io.c b/hw/xfree86/os-support/linux/lnx_io.c index dda1ff8ef..303c6e3d3 100644 --- a/hw/xfree86/os-support/linux/lnx_io.c +++ b/hw/xfree86/os-support/linux/lnx_io.c @@ -90,9 +90,10 @@ KDKBDREP_ioctl_ok(int rate, int delay) { /* don't change, just test */ kbdrep_s.rate = -1; kbdrep_s.delay = -1; - if (ioctl( xf86Info.consoleFd, KDKBDREP, &kbdrep_s )) { + if (ioctl( 0, KDKBDREP, &kbdrep_s )) { return 0; } + /* do the change */ if (rate == 0) /* switch repeat off */ kbdrep_s.rate = 0; @@ -104,7 +105,7 @@ KDKBDREP_ioctl_ok(int rate, int delay) { if (kbdrep_s.delay < 1) kbdrep_s.delay = 1; - if (ioctl( xf86Info.consoleFd, KDKBDREP, &kbdrep_s )) { + if (ioctl( 0, KDKBDREP, &kbdrep_s )) { return 0; } @@ -129,9 +130,8 @@ KIOCSRATE_ioctl_ok(int rate, int delay) { if (kbdrate_s.rate > 50) kbdrate_s.rate = 50; - if (ioctl( fd, KIOCSRATE, &kbdrate_s )) { - return 0; - } + if (ioctl( fd, KIOCSRATE, &kbdrate_s )) + return 0; close( fd ); @@ -143,7 +143,12 @@ KIOCSRATE_ioctl_ok(int rate, int delay) { #undef rate +#if NeedFunctionPrototypes void xf86SetKbdRepeat(char rad) +#else +void xf86SetKbdRepeat(rad) +char rad; +#endif { #ifdef __sparc__ int rate = 500; /* Default rate */ @@ -173,6 +178,7 @@ void xf86SetKbdRepeat(char rad) if (xf86Info.kbdDelay >= 0) delay = xf86Info.kbdDelay; + if(KDKBDREP_ioctl_ok(rate, delay)) /* m68k? */ return; diff --git a/hw/xfree86/os-support/linux/lnx_jstk.c b/hw/xfree86/os-support/linux/lnx_jstk.c index 90a8bc106..2423bd45e 100644 --- a/hw/xfree86/os-support/linux/lnx_jstk.c +++ b/hw/xfree86/os-support/linux/lnx_jstk.c @@ -23,7 +23,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_jstk.c,v 3.8.2.1 1998/06/05 16:23:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_jstk.c,v 3.13 1998/07/25 16:56:43 dawes Exp $ */ static const char rcs_id[] = "Id: lnx_jstk.c,v 1.1 1995/12/20 14:06:09 lepied Exp"; diff --git a/hw/xfree86/os-support/linux/lnx_kbd.c b/hw/xfree86/os-support/linux/lnx_kbd.c index 68f3af38b..1344cecec 100644 --- a/hw/xfree86/os-support/linux/lnx_kbd.c +++ b/hw/xfree86/os-support/linux/lnx_kbd.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.c,v 1.4 2003/11/03 05:11:52 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.c,v 1.3 2003/08/19 17:32:34 tsi Exp $ */ /* * Copyright (c) 2002 by The XFree86 Project, Inc. @@ -27,7 +27,7 @@ static KbdProtocolRec protocols[] = { {"standard", PROT_STD }, - { NULL, PROT_UNKNOWN_KBD } + { NULL, PROT_UNKNOWN } }; extern Bool VTSwitchEnabled; @@ -117,7 +117,7 @@ KDKBDREP_ioctl_ok(int rate, int delay) { /* don't change, just test */ kbdrep_s.rate = -1; kbdrep_s.delay = -1; - if (ioctl( xf86Info.consoleFd, KDKBDREP, &kbdrep_s )) { + if (ioctl( 0, KDKBDREP, &kbdrep_s )) { return 0; } @@ -132,8 +132,8 @@ KDKBDREP_ioctl_ok(int rate, int delay) { if (kbdrep_s.delay < 1) kbdrep_s.delay = 1; - if (ioctl( xf86Info.consoleFd, KDKBDREP, &kbdrep_s )) { - return 0; + if (ioctl( 0, KDKBDREP, &kbdrep_s )) { + return 0; } return 1; /* success! */ @@ -157,9 +157,8 @@ KIOCSRATE_ioctl_ok(int rate, int delay) { if (kbdrate_s.rate > 50) kbdrate_s.rate = 50; - if (ioctl( fd, KIOCSRATE, &kbdrate_s )) { - return 0; - } + if (ioctl( fd, KIOCSRATE, &kbdrate_s )) + return 0; close( fd ); @@ -447,7 +446,7 @@ OpenKeyboard(InputInfoPtr pInfo) { KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; int i; - KbdProtocolId prot = PROT_UNKNOWN_KBD; + KbdProtocolId prot = PROT_UNKNOWN; char *s; s = xf86SetStrOption(pInfo->options, "Protocol", NULL); diff --git a/hw/xfree86/os-support/linux/lnx_kbd.h b/hw/xfree86/os-support/linux/lnx_kbd.h index 7b9cd434e..ac783bfbc 100644 --- a/hw/xfree86/os-support/linux/lnx_kbd.h +++ b/hw/xfree86/os-support/linux/lnx_kbd.h @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.h,v 1.1 2002/10/11 01:40:35 dawes Exp $ */ extern void KbdGetMapping(InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap); diff --git a/hw/xfree86/os-support/linux/lnx_kmod.c b/hw/xfree86/os-support/linux/lnx_kmod.c index cf18bcab6..0cb69b209 100644 --- a/hw/xfree86/os-support/linux/lnx_kmod.c +++ b/hw/xfree86/os-support/linux/lnx_kmod.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c,v 3.5 2001/10/01 13:44:14 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c,v 3.6 2001/10/31 22:50:30 tsi Exp $ */ #include <errno.h> #include <fcntl.h> diff --git a/hw/xfree86/os-support/linux/lnx_mouse.c b/hw/xfree86/os-support/linux/lnx_mouse.c index 3d0d30f52..8bc7e6331 100644 --- a/hw/xfree86/os-support/linux/lnx_mouse.c +++ b/hw/xfree86/os-support/linux/lnx_mouse.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_mouse.c,v 1.2 2003/10/08 14:58:30 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_mouse.c,v 1.1 1999/05/17 13:17:18 dawes Exp $ */ /* * Copyright 1999 by The XFree86 Project, Inc. @@ -8,10 +8,6 @@ #include "xf86.h" #include "xf86Xinput.h" #include "xf86OSmouse.h" -#include "xf86_OSlib.h" -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> static int SupportedInterfaces(void) @@ -19,172 +15,6 @@ SupportedInterfaces(void) return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO; } -static const char * -DefaultProtocol(void) -{ - return "Auto"; -} - -#define DEFAULT_MOUSE_DEV "/dev/mouse" -#define DEFAULT_PS2_DEV "/dev/psaux" -#define DEFAULT_GPM_DATA_DEV "/dev/gpmdata" -#define DEFAULT_GPM_CTL_DEV "/dev/gpmdata" - -static const char *mouseDevs[] = { - DEFAULT_MOUSE_DEV, - DEFAULT_PS2_DEV, - DEFAULT_GPM_DATA_DEV, - NULL -}; - -typedef enum { - MOUSE_PROTO_UNKNOWN = 0, - MOUSE_PROTO_SERIAL, - MOUSE_PROTO_PS2, - MOUSE_PROTO_MSC, - MOUSE_PROTO_GPM -} protocolTypes; - -static struct { - protocolTypes proto; - const char *name; -} devproto[] = { - { MOUSE_PROTO_UNKNOWN, NULL }, - { MOUSE_PROTO_PS2, "PS/2" }, - { MOUSE_PROTO_MSC, "MouseSystems" }, - { MOUSE_PROTO_GPM, "GPM" } -}; - -static const char * -FindDevice(InputInfoPtr pInfo, const char *protocol, int flags) -{ - int fd = -1; - const char **pdev; - - for (pdev = mouseDevs; *pdev; pdev++) { - SYSCALL (fd = open(*pdev, O_RDWR | O_NONBLOCK | O_EXCL)); - if (fd == -1) { -#ifdef DEBUG - ErrorF("Cannot open %s (%s)\n", *pdev, strerror(errno)); -#endif - } else - break; - } - - if (*pdev) { - close(fd); - /* Set the Device option. */ - pInfo->conf_idev->commonOptions = - xf86AddNewOption(pInfo->conf_idev->commonOptions, "Device", *pdev); - xf86Msg(X_INFO, "%s: Setting Device option to \"%s\"\n", - pInfo->name, *pdev); - } - - return *pdev; -} - -static const char * -GuessProtocol(InputInfoPtr pInfo, int flags) -{ - int fd = -1; - const char *dev; - char *realdev; - struct stat sbuf; - int i; - int proto = MOUSE_PROTO_UNKNOWN; - - dev = xf86SetStrOption(pInfo->conf_idev->commonOptions, "Device", NULL); - if (!dev) { -#ifdef DEBUG - ErrorF("xf86SetStrOption failed to return the device name\n"); -#endif - return NULL; - } - /* Look at the device name to guess the protocol. */ - realdev = NULL; - if (strcmp(dev, DEFAULT_MOUSE_DEV) == 0) { - if (lstat(dev, &sbuf) != 0) { -#ifdef DEBUG - ErrorF("lstat failed for %s (%s)\n", dev, strerror(errno)); -#endif - return NULL; - } - if (S_ISLNK(sbuf.st_mode)) { - realdev = xnfalloc(PATH_MAX + 1); - i = readlink(dev, realdev, PATH_MAX); - if (i <= 0) { -#ifdef DEBUG - ErrorF("readlink failed for %s (%s)\n", dev, strerror(errno)); -#endif - xfree(realdev); - return NULL; - } - realdev[i] = '\0'; - } - } - if (!realdev) - realdev = xnfstrdup(dev); - else { - /* If realdev doesn't contain a '/' then prepend "/dev/" */ - if (!strchr(realdev, '/')) { - char *tmp = xnfalloc(strlen(realdev) + 5 + 1); - sprintf(tmp, "/dev/%s", realdev); - xfree(realdev); - realdev = tmp; - } - } - - if (strcmp(realdev, DEFAULT_PS2_DEV) == 0) - proto = MOUSE_PROTO_PS2; - else if (strcmp(realdev, DEFAULT_GPM_DATA_DEV) == 0) - proto = MOUSE_PROTO_MSC; - else if (strcmp(realdev, DEFAULT_GPM_CTL_DEV) == 0) - proto = MOUSE_PROTO_GPM; - xfree(realdev); - /* - * If the protocol can't be guessed from the device name, - * try to characterise it. - */ - if (proto == MOUSE_PROTO_UNKNOWN) { - SYSCALL (fd = open(dev, O_RDWR | O_NONBLOCK | O_EXCL)); - if (isatty(fd)) { - /* Serial PnP has already failed, so give up. */ - } else { - if (fstat(fd, &sbuf) != 0) { -#ifdef DEBUG - ErrorF("fstat failed for %s (%s)\n", dev, strerror(errno)); -#endif - close(fd); - return NULL; - } - if (S_ISFIFO(sbuf.st_mode)) { - /* Assume GPM data in MSC format. */ - proto = MOUSE_PROTO_MSC; - } else { - /* Default to PS/2 */ - proto = MOUSE_PROTO_PS2; - } - } - close(fd); - } - if (proto == MOUSE_PROTO_UNKNOWN) { - xf86Msg(X_ERROR, "%s: GuessProtocol: Cannot find mouse protocol.\n", - pInfo->name); - return NULL; - } else { - for (i = 0; i < sizeof(devproto)/sizeof(devproto[0]); i++) { - if (devproto[i].proto == proto) { - xf86Msg(X_INFO, - "%s: GuessProtocol: " - "setting mouse protocol to \"%s\"\n", - pInfo->name, devproto[i].name); - return devproto[i].name; - } - } - } - return NULL; -} - OSMouseInfoPtr xf86OSMouseInit(int flags) { @@ -194,9 +24,6 @@ xf86OSMouseInit(int flags) if (!p) return NULL; p->SupportedInterfaces = SupportedInterfaces; - p->DefaultProtocol = DefaultProtocol; - p->FindDevice = FindDevice; - p->GuessProtocol = GuessProtocol; return p; } diff --git a/hw/xfree86/os-support/linux/lnx_pci.c b/hw/xfree86/os-support/linux/lnx_pci.c index 41f76fd16..5477b9130 100644 --- a/hw/xfree86/os-support/linux/lnx_pci.c +++ b/hw/xfree86/os-support/linux/lnx_pci.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c,v 3.8 2002/04/09 15:59:37 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c,v 3.9 2003/02/17 15:29:22 dawes Exp $ */ #include <stdio.h> #include "X.h" diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c index 5144cdf3e..9f9e2d02c 100644 --- a/hw/xfree86/os-support/linux/lnx_video.c +++ b/hw/xfree86/os-support/linux/lnx_video.c @@ -454,7 +454,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) close(fd); if (base == MAP_FAILED) { FatalError("xf86MapVidMem: Could not mmap framebuffer" - " (0x%08lx,0x%lx) (%s)\n", Base, Size, + " (0x%08x,0x%x) (%s)\n", Base, Size, strerror(errno)); } #ifdef DEBUG |