diff options
Diffstat (limited to 'hw/xfree86/os-support/bsd/bsd_jstk.c')
-rw-r--r-- | hw/xfree86/os-support/bsd/bsd_jstk.c | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/hw/xfree86/os-support/bsd/bsd_jstk.c b/hw/xfree86/os-support/bsd/bsd_jstk.c index ab4a31420..7f24124dc 100644 --- a/hw/xfree86/os-support/bsd/bsd_jstk.c +++ b/hw/xfree86/os-support/bsd/bsd_jstk.c @@ -23,18 +23,22 @@ /* Modified for FreeBSD by David Dawes <dawes@XFree86.org> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_jstk.c,v 3.2 1996/01/12 14:34:41 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_jstk.c,v 3.8 2002/08/06 13:20:47 herrb Exp $ */ #include <sys/types.h> #include <unistd.h> #include <string.h> +#include <errno.h> #include <machine/joystick.h> #include <fcntl.h> -#define JS_RETURN sizeof(struct joystick) +#ifdef XFree86LOADER +#include "misc.h" +#include "xf86_libc.h" +#endif +#include "xf86.h" -extern int errno; -extern int xf86Verbose; +#define JS_RETURN sizeof(struct joystick) /*********************************************************************** * @@ -57,16 +61,16 @@ xf86JoystickOn(char * name, int *timeout, int *centerX, int *centerY) ErrorF("xf86JoystickOn: %s\n", name); #endif - if ((status = open(name, O_RDWR | O_NDELAY)) < 0) + if ((status = open(name, O_RDWR | O_NDELAY, 0)) < 0) { - ErrorF("xf86JoystickOn: Cannot open joystick '%s' (%s)\n", name, - strerror(errno)); + xf86Msg(X_WARNING, "xf86JoystickOn: Cannot open joystick '%s' (%s)\n", + name, strerror(errno)); return -1; } if (*timeout <= 0) { /* Use the current setting */ - ioctl(status, JOY_GETTIMEOUT, &timeinmicros); + ioctl(status, JOY_GETTIMEOUT, (char *)&timeinmicros); *timeout = timeinmicros / 1000; if (*timeout == 0) *timeout = 1; @@ -78,8 +82,8 @@ xf86JoystickOn(char * name, int *timeout, int *centerX, int *centerY) changed = 1; } - if (changed && xf86Verbose) - ErrorF("(--) Joystick: timeout value = %d\n", *timeout); + if (changed) + xf86Msg(X_PROBED, "Joystick: timeout value = %d\n", *timeout); timeinmicros = *timeout * 1000; @@ -87,15 +91,11 @@ xf86JoystickOn(char * name, int *timeout, int *centerX, int *centerY) read(status, &js, JS_RETURN); if (*centerX < 0) { *centerX = js.x; - if (xf86Verbose) { - ErrorF("(--) Joystick: CenterX set to %d\n", *centerX); - } + xf86Msg(X_PROBED, "Joystick: CenterX set to %d\n", *centerX); } if (*centerY < 0) { *centerY = js.y; - if (xf86Verbose) { - ErrorF("(--) Joystick: CenterY set to %d\n", *centerY); - } + xf86Msg(X_PROBED, "Joystick: CenterY set to %d\n", *centerY); } return status; @@ -126,9 +126,7 @@ xf86JoystickInit() */ int -xf86JoystickOff(fd, doclose) -int *fd; -int doclose; +xf86JoystickOff(int *fd, int doclose) { int oldfd; @@ -149,11 +147,7 @@ int doclose; */ int -xf86JoystickGetState(fd, x, y, buttons) -int fd; -int *x; -int *y; -int *buttons; +xf86JoystickGetState(int fd, int *x, int *y, int *buttons) { struct joystick js; int status; @@ -177,4 +171,15 @@ int *buttons; return 1; } +#ifdef XFree86LOADER +/* + * Entry point for XFree86 Loader + */ +void +bsd_jstkModuleInit(pointer *data, INT32 *magic) +{ + *magic = MAGIC_DONE; + *data = NULL; +} +#endif /* end of bsd_jstk.c */ |