Hello community,
here is the log from the commit of package xorg-x11-driver-input
checked in at Sun Apr 22 01:03:15 CEST 2007.
--------
--- xorg-x11-driver-input/xorg-x11-driver-input.changes 2007-04-03 18:33:18.000000000 +0200
+++ /mounts/work_src_done/STABLE/xorg-x11-driver-input/xorg-x11-driver-input.changes 2007-04-21 11:07:44.971490000 +0200
@@ -1,0 +2,25 @@
+Sat Apr 21 11:05:19 CEST 2007 - sndirsch@suse.de
+
+- updated joystick driver to release 1.2.1
+ * jstkVersionRec: Use macros for module version. Fixes #10498
+ * Check for Joystick API Version >=1 instead of >=2
+ * Don't return NULL on jstCorePreInit fail, fixes X crash.
+ * Fixed remaining opened filedescriptors, if ioctl fails
+ * Fixed DEVICE_ON still returning Success on error opening
+ device, resulting in a crash
+ * Fixed wrong type in ioctl call for detecting buttons and axes
+ resulting in endless loop on BSD with linux_js module
+ * Typo in linux_jstk.c: Info about number of axes and buttons
+ was interchanged
+ * Fixed correct calculation of absolute axis position when
+ centered
+ * Added USB-HID backend for *BSD
+ * Replaced xf86CheckXXXOption with xf86SetXXXOption, Fixed
+ possible NULL pointer dereference in device remove
+ * Wrapped enums and structs in typedefs
+ * Fixed possible double close of device in case of error.
+ * Considering JS_EVENT_INIT events as real events again
+ * Fixed accelerated axis movement not working the first time
+ after startup
+
+-------------------------------------------------------------------
Old:
----
xf86-input-joystick-1.2.0.tar.bz2
New:
----
xf86-input-joystick-1.2.1.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ xorg-x11-driver-input.spec ++++++
--- /var/tmp/diff_new_pack.G24279/_old 2007-04-22 01:02:43.000000000 +0200
+++ /var/tmp/diff_new_pack.G24279/_new 2007-04-22 01:02:43.000000000 +0200
@@ -15,7 +15,7 @@
BuildRequires: Mesa-devel pkgconfig xorg-x11-proto-devel xorg-x11-server-sdk
Url: http://xorg.freedesktop.org/
Version: 7.2
-Release: 45
+Release: 47
License: X11/MIT
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Group: System/X11/Servers/XF86_4
@@ -34,7 +34,7 @@
Source10: xf86-input-fpit-X11R7.1-1.1.0.tar.bz2
Source11: xf86-input-hyperpen-X11R7.1-1.1.0.tar.bz2
Source12: xf86-input-jamstudio-X11R7.1-1.1.0.tar.bz2
-Source13: xf86-input-joystick-1.2.0.tar.bz2
+Source13: xf86-input-joystick-1.2.1.tar.bz2
Source14: xf86-input-keyboard-1.1.1.tar.bz2
Source15: xf86-input-magellan-X11R7.1-1.1.0.tar.bz2
Source16: xf86-input-magictouch-X11R7.1-1.0.0.5.tar.bz2
@@ -138,6 +138,28 @@
%{_mandir}/man4/*
%changelog
+* Sat Apr 21 2007 - sndirsch@suse.de
+- updated joystick driver to release 1.2.1
+ * jstkVersionRec: Use macros for module version. Fixes #10498
+ * Check for Joystick API Version >=1 instead of >=2
+ * Don't return NULL on jstCorePreInit fail, fixes X crash.
+ * Fixed remaining opened filedescriptors, if ioctl fails
+ * Fixed DEVICE_ON still returning Success on error opening
+ device, resulting in a crash
+ * Fixed wrong type in ioctl call for detecting buttons and axes
+ resulting in endless loop on BSD with linux_js module
+ * Typo in linux_jstk.c: Info about number of axes and buttons
+ was interchanged
+ * Fixed correct calculation of absolute axis position when
+ centered
+ * Added USB-HID backend for *BSD
+ * Replaced xf86CheckXXXOption with xf86SetXXXOption, Fixed
+ possible NULL pointer dereference in device remove
+ * Wrapped enums and structs in typedefs
+ * Fixed possible double close of device in case of error.
+ * Considering JS_EVENT_INIT events as real events again
+ * Fixed accelerated axis movement not working the first time
+ after startup
* Tue Apr 03 2007 - sndirsch@suse.de
- updated joystick driver to release 1.2.0:
* Added man page
++++++ xf86-input-joystick-1.2.0.tar.bz2 -> xf86-input-joystick-1.2.1.tar.bz2 ++++++
++++ 1760 lines of diff (skipped)
++++ retrying with extended exclude list
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-input-joystick-1.2.0/configure.ac new/xf86-input-joystick-1.2.1/configure.ac
--- old/xf86-input-joystick-1.2.0/configure.ac 2007-03-22 03:43:49.000000000 +0100
+++ new/xf86-input-joystick-1.2.1/configure.ac 2007-04-19 04:40:44.000000000 +0200
@@ -22,7 +22,7 @@
AC_PREREQ(2.57)
AC_INIT([xf86-input-joystick],
- 1.2.0,
+ 1.2.1,
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
xf86-input-joystick)
@@ -44,27 +44,28 @@
AH_TOP([#include "xorg-server.h"])
-#AC_DEFINE(XFree86LOADER,1,[Stub define for loadable drivers])
-#
-#AC_ARG_ENABLE(XINPUT, AS_HELP_STRING([--enable-xinput],
-# [Build XInput support (default: yes)]),
-# [XINPUT=$enableval],[XINPUT=yes])
-#AM_CONDITIONAL(XINPUT, test "x$XINPUT" = "xyes")
-#if test "x$XINPUT" = "xyes" ; then
-# AC_DEFINE(XINPUT,1,[Enable XInput support])
-#fi
-#
-#AC_ARG_ENABLE(XKB, AS_HELP_STRING([--enable-xkb],
-# [Build XKB support (default: yes)]),
-# [XKB=$enableval],[XKB=yes])
-#AM_CONDITIONAL(XKB, test "x$XKB" = "xyes")
-#if test "x$XKB" = "xyes" ; then
-# AC_DEFINE(XKB,1,[Enable XKB support])
-#fi
+case $host_os in
+ linux*)
+ IS_LINUX="yes"
+ ;;
+
+ freebsd* | kfreebsd-gnu* | netbsd* | openbsd*)
+ IS_BSD="yes"
+ ;;
+
+ *)
+ AC_MSG_ERROR([Your operating system is not supported by the joystick
+ driver. Contact xorg@lists.freedesktop.org if you are
+ interested in porting it.])
+ ;;
+esac
+AM_CONDITIONAL(LINUX, [test "x$IS_LINUX" = xyes])
+AM_CONDITIONAL(BSD, [test "x$IS_BSD" = xyes])
AC_ARG_WITH(xorg-module-dir,
AC_HELP_STRING([--with-xorg-module-dir=DIR],
- [Default xorg module directory [[default=$libdir/xorg/modules]]]),
+ [Default xorg module directory
+ [[default=$libdir/xorg/modules]]]),
[moduledir="$withval"],
[moduledir="$libdir/xorg/modules"])
inputdir=${moduledir}/input
@@ -75,7 +76,8 @@
XORG_DRIVER_CHECK_EXT(XINPUT, inputproto)
# Checks for pkg-config packages
-PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901] xproto $REQUIRED_MODULES)
+PKG_CHECK_MODULES(XORG,
+ [xorg-server >= 1.0.99.901] xproto $REQUIRED_MODULES)
sdkdir=$(pkg-config --variable=sdkdir xorg-server)
CFLAGS="$CFLAGS $XORG_CFLAGS "' -I$(top_srcdir)/src'
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-input-joystick-1.2.0/man/joystick.man new/xf86-input-joystick-1.2.1/man/joystick.man
--- old/xf86-input-joystick-1.2.0/man/joystick.man 2007-03-30 20:23:41.000000000 +0200
+++ new/xf86-input-joystick-1.2.1/man/joystick.man 2007-04-19 04:40:44.000000000 +0200
@@ -13,7 +13,8 @@
.fi
.SH DESCRIPTION
.B joystick
-is an __xservername__ input driver for Linux\'s joystick devices.
+is an __xservername__ input driver for Joysticks, using either Linux\'s
+joystick devices or *BSD\'s uhid devices.
.SH SUPPORTED HARDWARE
In general, every by the kernel supported joystick should be supported through the
@@ -33,9 +34,13 @@
are supported:
.TP 7
.BI "Option \*qDevice\*q \*q" string \*q
-Specifies the device through which the joystick can be accessed.
-The first joystick is mostly accessible under "/dev/input/js0".
-This option is mandatory, and there is no default setting.
+Specifies the device through which the joystick can be accessed. This option is mandatory and there is no default setting.
+
+For Linux, joysticks are mostly accessible as
+.IR /dev/input/jsX .
+
+For *BSD, joysticks are recognized as
+.IR /dev/uhidX .
.TP 7
.BI "Option \*qDebugLevel\*q \*q" integer \*q
If compiled with debugging information, controls the verbosity of the driver.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-input-joystick-1.2.0/src/bsd_jstk.c new/xf86-input-joystick-1.2.1/src/bsd_jstk.c
--- old/xf86-input-joystick-1.2.0/src/bsd_jstk.c 1970-01-01 01:00:00.000000000 +0100
+++ new/xf86-input-joystick-1.2.1/src/bsd_jstk.c 2007-04-21 03:05:57.000000000 +0200
@@ -0,0 +1,315 @@
+/*
+ * Copyright 2007 by Sascha Hlusiak.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * 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 name of Sascha Hlusiak not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Sascha Hlusiak makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * SASCHA HLUSIAK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL SASCHA HLUSIAK 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.
+ *
+ */
+
+/**
+ * This provides the backend for USB-HIDs for NetBSD, OpenBSD and FreeBSD
+ * Needs the uhid module loaded. Device names are /dev/uhid?
+ **/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include
+#include
+#include
+
+#include "jstk.h"
+#include "jstk_hw.h"
+
+
+struct jstk_bsd_hid_data {
+ int dlen; /* Length of one data chunk */
+ char *data_buf; /* Data buffer with right size */
+ struct hid_item axis_item[MAXAXES]; /* Axis HID items */
+ struct hid_item button_item[MAXBUTTONS]; /* Button HID items */
+ struct hid_item hat_item[MAXAXES]; /* HID items for hats */
+ int hats; /* Number of hats */
+ int axes; /* Number of found axes */
+ int buttons; /* Number of found buttons */
+ int hotdata; /* Is unprocessed data available
+ in data_buf? */
+};
+
+
+
+
+
+/***********************************************************************
+ *
+ * jstkOpenDevice --
+ *
+ * Open and initialize a joystick device
+ * Returns the filedescriptor, or -1 in case of error
+ *
+ ***********************************************************************
+ */
+
+int
+jstkOpenDevice(JoystickDevPtr joystick)
+{
+ int cur_axis;
+ int is_joystick, report_id = 0;
+ int got_something;
+ struct hid_data *d;
+ struct hid_item h;
+ report_desc_t rd;
+ struct jstk_bsd_hid_data *bsddata;
+
+ if ((joystick->fd = open(joystick->device, O_RDWR | O_NDELAY, 0)) < 0) {
+ xf86Msg(X_ERROR, "Cannot open joystick '%s' (%s)\n", joystick->device,
+ strerror(errno));
+ return -1;
+ }
+
+ if ((rd = hid_get_report_desc(joystick->fd)) == 0) {
+ xf86Msg(X_ERROR, "Joystick: hid_get_report_desc failed: %s\n",
+ strerror(errno));
+ close(joystick->fd);
+ joystick->fd = -1;
+ return -1;
+ }
+
+ if (ioctl(joystick->fd, USB_GET_REPORT_ID, &report_id) < 0) {
+ xf86Msg(X_ERROR, "Joystick: ioctl USB_GET_REPORT_ID failed: %s\n",
+ strerror(errno));
+ close(joystick->fd);
+ joystick->fd = -1;
+ return -1;
+ }
+
+ bsddata = (struct jstk_bsd_hid_data*)
+ malloc(sizeof(struct jstk_bsd_hid_data));
+ bsddata->dlen = hid_report_size(rd, hid_input, report_id);
+
+ if ((bsddata->data_buf = malloc(bsddata->dlen)) == NULL) {
+ fprintf(stderr, "error: couldn't malloc %d bytes\n", bsddata->dlen);
+ hid_dispose_report_desc(rd);
+ free(bsddata);
+ close(joystick->fd);
+ joystick->fd = -1;
+ return -1;
+ }
+
+ is_joystick = 0;
+ got_something = 0;
+ cur_axis = 0;
+ bsddata->hats = 0;
+ bsddata->axes = 0;
+ bsddata->buttons = 0;
+
+ for (d = hid_start_parse(rd, 1 << hid_input, report_id);
+ hid_get_item(d, &h); ) {
+ int usage, page;
+
+ page = HID_PAGE(h.usage);
+ usage = HID_USAGE(h.usage);
+
+ is_joystick = is_joystick ||
+ (h.kind == hid_collection &&
+ page == HUP_GENERIC_DESKTOP &&
+ (usage == HUG_JOYSTICK || usage == HUG_GAME_PAD));
+
+ if (h.kind != hid_input)
+ continue;
+
+ if (!is_joystick)
+ continue;
+
+ if (page == HUP_GENERIC_DESKTOP)
+ {
+ if (usage == HUG_HAT_SWITCH)
+ {
+ if ((bsddata->hats < MAXAXES) && (bsddata->axes <= MAXAXES-2)) {
+ got_something = 1;
+ memcpy(&bsddata->hat_item[bsddata->hats], &h, sizeof(h));
+ bsddata->hats++;
+ bsddata->axes += 2;
+ }
+ }
+ else
+ {
+ if (bsddata->axes < MAXAXES) {
+ got_something = 1;
+ memcpy(&bsddata->axis_item[cur_axis], &h, sizeof(h));
+ cur_axis++;
+ bsddata->axes++;
+ }
+ }
+ }
+ else if (page == HUP_BUTTON)
+ {
+ if (bsddata->buttons < MAXBUTTONS) {
+ got_something = 1;
+ memcpy(&bsddata->button_item[bsddata->buttons], &h, sizeof(h));
+ bsddata->buttons++;
+ }
+ }
+ }
+ hid_end_parse(d);
+
+ if (!got_something) {
+ free(bsddata->data_buf);
+ xf86Msg(X_ERROR, "Joystick: Didn't find any usable axes.\n");
+ free(bsddata);
+ close(joystick->fd);
+ joystick->fd = -1;
+ return -1;
+ }
+
+ bsddata->hotdata = 0;
+ joystick->devicedata = (void*) bsddata;
+ xf86Msg(X_INFO, "Joystick: %d buttons, %d axes\n",
+ bsddata->buttons, bsddata->axes);
+
+ return joystick->fd;
+}
+
+
+/***********************************************************************
+ *
+ * jstkCloseDevice --
+ *
+ * close the handle.
+ *
+ ***********************************************************************
+ */
+
+void
+jstkCloseDevice(JoystickDevPtr joystick)
+{
+ if ((joystick->fd >= 0)) {
+ xf86CloseSerial(joystick->fd);
+ joystick->fd = -1;
+ }
+ if (joystick->devicedata != NULL) {
+ if ((((struct jstk_bsd_hid_data*)joystick->devicedata)->data_buf) != NULL)
+ free(((struct jstk_bsd_hid_data*)joystick->devicedata)->data_buf);
+ free(joystick->devicedata);
+ }
+}
+
+
+/***********************************************************************
+ *
+ * jstkReadData --
+ *
+ * Reads data from fd and stores it in the JoystickDevRec struct
+ * fills in the type of event and the number of the button/axis
+ * return 1 if success, 0 otherwise. Success does not neccessarily
+ * mean that there is a new event waiting.
+ *
+ ***********************************************************************
+ */
+
+int
+jstkReadData(JoystickDevPtr joystick,
+ JOYSTICKEVENT *event,
+ int *number)
+{
+ int j,d;
+ struct jstk_bsd_hid_data *bsddata =
+ (struct jstk_bsd_hid_data*)(joystick->devicedata);
+
+ if (event != NULL) *event = EVENT_NONE;
+ if (bsddata->hotdata == 0) {
+ j= xf86ReadSerial(joystick->fd,
+ bsddata->data_buf,
+ bsddata->dlen
+ );
+ if (j != bsddata->dlen) {
+ ErrorF("Read: %d byte! Should be %d\n",j,bsddata->dlen);
+ return 0;
+ }
+ bsddata->hotdata = 1;
+ }
+
+ for (j=0; j<bsddata->axes - (bsddata->hats * 2); j++)
+ {
+ d = hid_get_data(bsddata->data_buf, &bsddata->axis_item[j]);
+ /* Scale the range to our expected range of -32768 to 32767 */
+ d = d - (bsddata->axis_item[j].logical_maximum
+ - bsddata->axis_item[j].logical_minimum) / 2;
+ d = d * 65536 / (bsddata->axis_item[j].logical_maximum
+ - bsddata->axis_item[j].logical_minimum);
+ if (abs(d) < joystick->axis[j].deadzone) d = 0;
+ if (d != joystick->axis[j].value) {
+ joystick->axis[j].value = d;
+ if (event != NULL) *event = EVENT_AXIS;
+ if (number != NULL) *number = j;
+ return 2;
+ }
+ }
+
+ for (j=0; j<bsddata->hats; j++)
+ {
+ int a;
+ int v1_data[9] =
+ { 0, 32767, 32767, 32767, 0, -32768, -32768, -32768, 0 };
+ int v2_data[9] =
+ { -32768, -32768, 0, 32767, 32767, 32767, 0, -32767, 0 };
+
+ a = j*2 + bsddata->axes - bsddata->hats *2;
+ d = hid_get_data(bsddata->data_buf, &bsddata->hat_item[j])
+ - bsddata->hat_item[j].logical_minimum;
+ if (joystick->axis[a].value != v1_data[d]) {
+ joystick->axis[a].value = v1_data[d];
+ if (event != NULL) *event = EVENT_AXIS;
+ if (number != NULL) *number = a;
+ return 2;
+ }
+ if (joystick->axis[a+1].value != v2_data[d]) {
+ joystick->axis[a+1].value = v2_data[d];
+ if (event != NULL) *event = EVENT_AXIS;
+ if (number != NULL) *number = a+1;
+ return 2;
+ }
+ }
+
+ for (j=0; j<bsddata->buttons; j++)
+ {
+ int pressed;
+ d = hid_get_data(bsddata->data_buf, &bsddata->button_item[j]);
+ pressed = (d == bsddata->button_item[j].logical_minimum) ? 0 : 1;
+ if (pressed != joystick->button[j].pressed) {
+ joystick->button[j].pressed = pressed;
+ if (event != NULL) *event = EVENT_BUTTON;
+ if (number != NULL) *number = j;
+ return 2;
+ }
+ }
+
+ bsddata->hotdata = 0;
+
+ return 1;
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-input-joystick-1.2.0/src/jstk_axis.c new/xf86-input-joystick-1.2.1/src/jstk_axis.c
--- old/xf86-input-joystick-1.2.0/src/jstk_axis.c 2007-04-01 04:24:13.000000000 +0200
+++ new/xf86-input-joystick-1.2.1/src/jstk_axis.c 2007-04-19 18:37:01.000000000 +0200
@@ -68,7 +68,7 @@
float p1 = 0.0f; /* Pixels to move cursor */
float p2 = 0.0f; /* Pixels to scroll */
float scale;
- struct AXIS *axis;
+ AXIS *axis;
axis = &priv->axis[i];
nexttimer = NEXTTIMER;
@@ -89,9 +89,9 @@
} else if (axis->type == TYPE_ACCELERATED) {
/* Stop to accelerate at a certain speed */
- if (axis->temp < 100.0f) axis->temp *= 1.15f;
-
- p1 = (axis->temp - 0.1f) * (float)NEXTTIMER / 180.0f;
+ if (axis->currentspeed < 100.0f) axis->currentspeed =
+ (axis->currentspeed + 3.0) * 1.07f - 3.0;
+ p1 = axis->currentspeed * (float)NEXTTIMER / 180.0f;
p2 = p1 / 8.0f;
}
if (axis->value < 0) {
@@ -124,9 +124,10 @@
float p1;
float p2;
- if (priv->button[i].temp < 100.0f) priv->button[i].temp *= 1.15f;
- p1 = (priv->button[i].temp - 0.1) * (float)NEXTTIMER / 180.0f *
- ((float)priv->button[i].value) / 1000.0f;
+ if (priv->button[i].currentspeed < 100.0f) priv->button[i].currentspeed =
+ (priv->button[i].currentspeed + 3.0) * 1.07f - 3.0;
+ p1 = priv->button[i].currentspeed * (float)NEXTTIMER / 180.0f *
+ priv->button[i].amplify;
p1 *= priv->amplify;
p2 = p1 / 8.0f;
@@ -207,7 +208,8 @@
***********************************************************************
*/
void
-jstkStartAxisTimer(LocalDevicePtr device, int number) {
+jstkStartAxisTimer(LocalDevicePtr device, int number)
+{
int pixel;
JoystickDevPtr priv = device->private;
@@ -253,7 +255,8 @@
*/
void
-jstkStartButtonAxisTimer(LocalDevicePtr device, int number) {
+jstkStartButtonAxisTimer(LocalDevicePtr device, int number)
+{
int pixel;
JoystickDevPtr priv = device->private;
@@ -261,7 +264,7 @@
priv->timerrunning = TRUE;
pixel = 1;
- if (priv->button[number].value < 0) pixel = -1;
+ if (priv->button[number].amplify < 0) pixel = -1;
switch (priv->button[number].mapping) {
case MAPPING_X:
priv->x += pixel;
@@ -298,7 +301,8 @@
***********************************************************************
*/
void
-jstkHandleAbsoluteAxis(LocalDevicePtr device, int number) {
+jstkHandleAbsoluteAxis(LocalDevicePtr device, int number)
+{
JoystickDevPtr priv = device->private;
int i,x,y;
@@ -310,9 +314,11 @@
{
float rel;
int dif;
- rel = (priv->axis[i].value > 0) ?
- (priv->axis[i].value - priv->axis[i].deadzone) :
- (priv->axis[i].value + priv->axis[i].deadzone);
+ if (priv->axis[i].value >= priv->axis[i].deadzone)
+ rel = (priv->axis[i].value - priv->axis[i].deadzone);
+ if (priv->axis[i].value <= -priv->axis[i].deadzone)
+ rel = (priv->axis[i].value + priv->axis[i].deadzone);
+
rel = (rel) / (2.0f * (float)(32768 - priv->axis[i].deadzone));
/* rel contains numbers between -0.5 and +0.5 now */
@@ -321,15 +327,15 @@
DBG(5, ErrorF("Relative Position of axis %d: %.2f\n", i, rel));
/* Calculate difference to previous position on screen in pixels */
- dif = (int)(rel - priv->axis[i].temp + 0.5f);
+ dif = (int)(rel - priv->axis[i].previousposition + 0.5f);
if ((dif >= 1)||(dif <= -1)) {
if (priv->axis[i].mapping == MAPPING_X) {
x += (dif);
- priv->axis[i].temp += (float)dif;
+ priv->axis[i].previousposition += (float)dif;
}
if (priv->axis[i].mapping == MAPPING_Y) {
y += (int)(dif);
- priv->axis[i].temp += (float)dif;
+ priv->axis[i].previousposition += (float)dif;
}
}
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-input-joystick-1.2.0/src/jstk.c new/xf86-input-joystick-1.2.1/src/jstk.c
--- old/xf86-input-joystick-1.2.0/src/jstk.c 2007-04-01 04:03:40.000000000 +0200
+++ new/xf86-input-joystick-1.2.1/src/jstk.c 2007-04-19 04:40:44.000000000 +0200
@@ -6,15 +6,15 @@
* 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 name of Sascha Hlusiak not be used in
+ * documentation, and that the names of copyright holders not be used in
* advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Sascha Hlusiak makes no
+ * specific, written prior permission. The copyright holders make no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
- * SASCHA HLUSIAK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL SASCHA HLUSIAK BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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
@@ -32,18 +32,14 @@
#include
#include
#include
-#include
#include /* Needed for InitValuator/Proximity stuff */
#include
-
-#ifdef XFree86LOADER
#include
-#endif
#include "jstk.h"
-#include "linux_jstk.h"
+#include "jstk_hw.h"
#include "jstk_axis.h"
#include "jstk_options.h"
@@ -100,17 +96,19 @@
static void
jstkReadProc(LocalDevicePtr local)
{
- enum JOYSTICKEVENT event;
+ JOYSTICKEVENT event;
int number;
int i;
+ int r;
JoystickDevPtr priv = local->private;
- if (jstkReadData(priv, &event, &number)==0) {
+ do {
+ if ((r=jstkReadData(priv, &event, &number))==0) {
xf86Msg(X_WARNING, "JOYSTICK: Read failed. Deactivating device.\n");
if (local->fd >= 0)
- RemoveEnabledDevice(local->fd);
+ RemoveEnabledDevice(local->fd);
return;
}
@@ -122,7 +120,7 @@
switch (priv->button[number].mapping) {
case MAPPING_BUTTON:
if (priv->mouse_enabled == TRUE) {
- xf86PostButtonEvent(local->dev, 0, priv->button[number].value,
+ xf86PostButtonEvent(local->dev, 0, priv->button[number].buttonnumber,
priv->button[number].pressed, 0, 0);
}
break;
@@ -132,7 +130,7 @@
case MAPPING_ZX:
case MAPPING_ZY:
if (priv->button[number].pressed == 0) /* If button was released */
- priv->button[number].temp = 1.0; /* Reset speed counter */
+ priv->button[number].currentspeed = 1.0; /* Reset speed counter */
else if (priv->mouse_enabled == TRUE)
jstkStartButtonAxisTimer(local, number);
break;
@@ -159,7 +157,7 @@
for (i=0; ibutton[i].pressed) &&
(priv->button[i].mapping == MAPPING_SPEED_MULTIPLY))
- priv->amplify *= ((float)priv->button[i].value) / 1000.0f;
+ priv->amplify *= priv->button[i].amplify;
}
DBG(2, ErrorF("Global amplify is now %.3f\n", priv->amplify));
@@ -212,7 +210,7 @@
case TYPE_BYVALUE:
case TYPE_ACCELERATED:
if (priv->axis[number].value == 0) /* When axis was released */
- priv->axis[number].temp = 1.0; /* Release speed counter */
+ priv->axis[number].currentspeed = 1.0; /* Release speed counter */
if (priv->mouse_enabled == TRUE)
jstkStartAxisTimer(local, number);
@@ -227,6 +225,7 @@
break;
}
}
+ } while (r == 2);
}
@@ -256,7 +255,7 @@
DBG(1, ErrorF("jstkDeviceControlProc what=INIT\n"));
for (i=1; ibuttons, map) == FALSE) {
+ if (InitButtonClassDeviceStruct(pJstk, MAXBUTTONS, map) == FALSE) {
ErrorF("unable to allocate Button class device\n");
return !Success;
}
@@ -295,11 +294,9 @@
break;
case DEVICE_ON:
- i = jstkOpenDevice(priv, FALSE);
-
DBG(1, ErrorF("jstkDeviceControlProc what=ON name=%s\n", priv->device));
- if (i != 0)
+ if (jstkOpenDevice(priv) != -1)
{
pJstk->public.on = TRUE;
local->fd = priv->fd;
@@ -337,16 +334,6 @@
/*
***************************************************************************
*
- * Dynamic loading functions
- *
- ***************************************************************************
- */
-#ifdef XFree86LOADER
-
-
-/*
- ***************************************************************************
- *
* jstkCorePreInit --
*
* Called when a device will be instantiated
@@ -391,6 +378,7 @@
priv->fd = -1;
priv->device = NULL;
+ priv->devicedata = NULL;
priv->x = 0.0f;
priv->y = 0.0f;
priv->zx = 0.0f;
@@ -403,27 +391,27 @@
/* Initialize default mappings */
for (i=0; iaxis[i].value = 0;
- priv->axis[i].deadzone = 1000;
- priv->axis[i].type = TYPE_BYVALUE;
- priv->axis[i].mapping = MAPPING_NONE;
- priv->axis[i].temp = 0.0f;
- priv->axis[i].amplify = 1.0f;
+ priv->axis[i].value = 0;
+ priv->axis[i].deadzone = 1000;
+ priv->axis[i].type = TYPE_BYVALUE;
+ priv->axis[i].mapping = MAPPING_NONE;
+ priv->axis[i].currentspeed = 0.0f;
+ priv->axis[i].amplify = 1.0f;
}
for (i=0; ibutton[i].pressed = 0;
- priv->button[i].value = 0;
- priv->button[i].mapping = MAPPING_NONE;
- priv->button[i].temp = 1.0f;
+ priv->button[i].pressed = 0;
+ priv->button[i].buttonnumber = 0;
+ priv->button[i].mapping = MAPPING_NONE;
+ priv->button[i].currentspeed = 1.0f;
}
/* First three joystick buttons generate mouse clicks */
- priv->button[0].mapping = MAPPING_BUTTON;
- priv->button[0].value = 1;
- priv->button[1].mapping = MAPPING_BUTTON;
- priv->button[1].value = 2;
- priv->button[2].mapping = MAPPING_BUTTON;
- priv->button[2].value = 3;
+ priv->button[0].mapping = MAPPING_BUTTON;
+ priv->button[0].buttonnumber = 1;
+ priv->button[1].mapping = MAPPING_BUTTON;
+ priv->button[1].buttonnumber = 2;
+ priv->button[2].mapping = MAPPING_BUTTON;
+ priv->button[2].buttonnumber = 3;
/* Two axes by default */
priv->axis[0].type = TYPE_BYVALUE;
@@ -436,21 +424,13 @@
xf86OptionListReport(local->options);
/* Joystick device is mandatory */
- priv->device = xf86CheckStrOption(dev->commonOptions, "Device", NULL);
+ priv->device = xf86SetStrOption(dev->commonOptions, "Device", NULL);
if (!priv->device) {
xf86Msg (X_ERROR, "%s: No Device specified.\n", local->name);
goto SetupProc_fail;
}
- xf86Msg(X_CONFIG, "%s: device is %s\n", local->name, priv->device);
- /* Open the device once, see if it works and get information */
- if (jstkOpenDevice(priv, TRUE) == -1) {
- goto SetupProc_fail;
- }
- jstkCloseDevice(priv);
-
-
xf86ProcessCommonOptions(local, local->options);
#if DEBUG
@@ -468,33 +448,30 @@
/* Process button mapping options */
- for (i=0; i<priv->buttons; i++) if (icommonOptions, p, NULL);
+ s = xf86SetStrOption(dev->commonOptions, p, NULL);
if (s != NULL) {
- xf86Msg(X_CONFIG, "%s: Option \"mapbutton%d\" \"%s\"\n",
- local->name, i+1, s);
jstkParseButtonOption(s, priv, i, local->name);
}
- DBG(1, ErrorF("Button %d mapped to %d (value=%d)\n", i+1,
- priv->button[i].mapping, priv->button[i].value));
+ DBG(1, xf86Msg(X_CONFIG, "Button %d mapped to %d\n", i+1,
+ priv->button[i].mapping));
}
/* Process button mapping options */
- for (i=0; i<priv->axes; i++) if (icommonOptions, p, NULL);
+ s = xf86SetStrOption(dev->commonOptions, p, NULL);
if (s != NULL) {
- xf86Msg(X_CONFIG, "%s: Option \"mapaxis%d\" \"%s\"\n",
- local->name, i+1, s);
jstkParseAxisOption(s, &priv->axis[i], local->name);
}
- DBG(1, ErrorF("Axis %d type is %d, mapped to %d, amplify=%.3f\n", i+1,
- priv->axis[i].type,
- priv->axis[i].mapping,
- priv->axis[i].amplify));
+ DBG(1, xf86Msg(X_CONFIG,
+ "Axis %d type is %d, mapped to %d, amplify=%.3f\n", i+1,
+ priv->axis[i].type,
+ priv->axis[i].mapping,
+ priv->axis[i].amplify));
}
/* return the LocalDevice */
@@ -505,8 +482,8 @@
if (priv)
xfree(priv);
if (local)
- xfree(local);
- return NULL;
+ local->private = NULL;
+ return local;
}
@@ -533,6 +510,7 @@
jstkDeviceControlProc(local->dev, DEVICE_OFF);
xfree (device);
+ local->private = NULL;
xf86DeleteInput(local, 0);
}
@@ -586,11 +564,6 @@
static void
jstkDriverUnplug(pointer p)
{
-/* LocalDevicePtr local = (LocalDevicePtr) p;
- JoystickDevPtr priv = (JoystickDevPtr) local->private;
- jstkDeviceControlProc(local->dev, DEVICE_OFF);
- xfree (priv);
- xfree (local);*/
DBG(0, ErrorF("jstkDriverUnplug\n"));
}
@@ -610,7 +583,9 @@
MODINFOSTRING1,
MODINFOSTRING2,
XORG_VERSION_CURRENT,
- 1, 1, 1,
+ PACKAGE_VERSION_MAJOR,
+ PACKAGE_VERSION_MINOR,
+ PACKAGE_VERSION_PATCHLEVEL,
ABI_CLASS_XINPUT,
ABI_XINPUT_VERSION,
MOD_CLASS_XINPUT,
@@ -631,5 +606,3 @@
jstkDriverPlug,
jstkDriverUnplug
};
-
-#endif /* XFree86LOADER */
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-input-joystick-1.2.0/src/jstk.h new/xf86-input-joystick-1.2.1/src/jstk.h
--- old/xf86-input-joystick-1.2.0/src/jstk.h 2007-03-30 16:35:34.000000000 +0200
+++ new/xf86-input-joystick-1.2.1/src/jstk.h 2007-04-19 04:40:44.000000000 +0200
@@ -44,78 +44,80 @@
**/
#if DEBUG
-extern int debug_level;
-#define DBG(lvl, f) {if ((lvl) <= debug_level) f;}
+ extern int debug_level;
+ #define DBG(lvl, f) {if ((lvl) <= debug_level) f;}
#else
-#define DBG(lvl, f)
+ #define DBG(lvl, f)
#endif
+typedef enum _JOYSTICKTYPE{
+ TYPE_NONE, /* Axis value is not relevant */
+ TYPE_BYVALUE, /* Speed of cursor is relative to amplitude */
+ TYPE_ACCELERATED, /* Speed is accelerated */
+ TYPE_ABSOLUTE /* The amplitude defines the cursor position */
+} JOYSTICKTYPE;
+
+typedef enum _JOYSTICKMAPPING{
+ MAPPING_NONE, /* Nothing */
+ MAPPING_X, /* X-Axis */
+ MAPPING_Y, /* Y-Axis */
+ MAPPING_ZX, /* Horizontal scrolling */
+ MAPPING_ZY, /* Vertical scrolling */
+ MAPPING_BUTTON, /* Mouse button */
+ MAPPING_KEY, /* Keyboard event */
+ MAPPING_SPEED_MULTIPLY, /* Will amplify all axis movement */
+ MAPPING_DISABLE, /* Disable mouse and key events */
+ MAPPING_DISABLE_MOUSE, /* Disable only mouse events */
+ MAPPING_DISABLE_KEYS /* Disable only key events */
+} JOYSTICKMAPPING;
+
+
+typedef struct _AXIS {
+ JOYSTICKTYPE type;
+ JOYSTICKMAPPING mapping;
+ int value;
+ int deadzone;
+ union {
+ float currentspeed;
+ float previousposition;
+ };
+ float amplify;
+} AXIS;
-#define MAXBUTTONS 32
-#define MAXAXES 32
#define MAXKEYSPERBUTTON 4
-enum JOYSTICKTYPE {
- TYPE_NONE,
- TYPE_BYVALUE, /* Speed of cursor is relative to amplitude */
- TYPE_ACCELERATED, /* Speed is accelerated */
- TYPE_ABSOLUTE /* The amplitude defines the cursor position */
-};
-
-enum JOYSTICKMAPPING {
- MAPPING_NONE=0,
- MAPPING_X,
- MAPPING_Y,
- MAPPING_ZX,
- MAPPING_ZY,
- MAPPING_BUTTON,
- MAPPING_KEY,
- MAPPING_SPEED_MULTIPLY,
- MAPPING_DISABLE,
- MAPPING_DISABLE_MOUSE,
- MAPPING_DISABLE_KEYS
-};
-
-enum JOYSTICKEVENT {
- EVENT_NONE=0,
- EVENT_BUTTON,
- EVENT_AXIS
-};
+typedef struct _BUTTON {
+ JOYSTICKMAPPING mapping;
+ char pressed;
+ union {
+ int buttonnumber; /* MAPPING_BUTTON */
+ struct {
+ float amplify; /* MAPPING_X/Y/ZX/ZY,
+ MAPPING_SPEED_MULTIPLY */
+ float currentspeed; /* MAPPING_X/Y/ZX/ZY */
+ };
+ unsigned int keys[MAXKEYSPERBUTTON]; /* MAPPING_KEY */
+ };
+} BUTTON;
+
+#define MAXBUTTONS 32
+#define MAXAXES 32
+typedef struct _JoystickDevRec {
+ int fd; /* Actual file descriptor */
+ void *devicedata; /* Extra platform device dependend data */
+ char *device; /* Name of the device */
+
+ OsTimerPtr timer; /* Timer for axis movement */
+ Bool timerrunning;
+ float x,y,zx,zy; /* Pending subpixel movements */
+ Bool mouse_enabled, keys_enabled;
+ float amplify; /* Global amplifier of axis movement */
-typedef struct
-{
- int fd; /* Actual file descriptor */
- char *device; /* Name of the device */
-
- OsTimerPtr timer;
- Bool timerrunning;
- float x,y,zx,zy; /* Pending subpixel movements */
-
- Bool mouse_enabled, keys_enabled;
- float amplify; /* Global amplifier of axis movement */
-
- struct AXIS
- {
- int value;
- int deadzone;
- float temp,amplify;
- enum JOYSTICKTYPE type;
- enum JOYSTICKMAPPING mapping;
- }axis[MAXAXES]; /* Configuration per axis */
-
- struct BUTTON
- {
- char pressed;
- int value;
- unsigned int keys[MAXKEYSPERBUTTON];
- float temp;
- enum JOYSTICKMAPPING mapping;
- }button[MAXBUTTONS]; /* Configuration per button */
- int axes, buttons; /* Number of axes and buttons */
+ AXIS axis[MAXAXES]; /* Configuration per axis */
+ BUTTON button[MAXBUTTONS]; /* Configuration per button */
} JoystickDevRec, *JoystickDevPtr;
-
#endif
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-input-joystick-1.2.0/src/jstk_hw.h new/xf86-input-joystick-1.2.1/src/jstk_hw.h
--- old/xf86-input-joystick-1.2.0/src/jstk_hw.h 1970-01-01 01:00:00.000000000 +0100
+++ new/xf86-input-joystick-1.2.1/src/jstk_hw.h 2007-04-19 04:40:44.000000000 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2007 by Sascha Hlusiak.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * 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 name of Sascha Hlusiak not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Sascha Hlusiak makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * SASCHA HLUSIAK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL SASCHA HLUSIAK 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.
+ *
+ */
+
+#ifndef _LINUX_JSTK_H_INCLUDED_
+#define _LINUX_JSTK_H_INCLUDED_
+
+typedef enum _JOYSTICKEVENT {
+ EVENT_NONE=0,
+ EVENT_BUTTON,
+ EVENT_AXIS
+} JOYSTICKEVENT;
+
+int jstkOpenDevice(JoystickDevPtr joystick);
+void jstkCloseDevice(JoystickDevPtr joystick);
+int jstkReadData(JoystickDevPtr joystick,
+ JOYSTICKEVENT *event, int *number);
+
+#endif
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-input-joystick-1.2.0/src/jstk_options.c new/xf86-input-joystick-1.2.1/src/jstk_options.c
--- old/xf86-input-joystick-1.2.0/src/jstk_options.c 2007-04-01 04:21:04.000000000 +0200
+++ new/xf86-input-joystick-1.2.1/src/jstk_options.c 2007-04-19 17:34:28.000000000 +0200
@@ -43,13 +43,14 @@
***********************************************************************
*/
-static enum JOYSTICKMAPPING
-jstkGetAxisMapping(float *value, const char* param, const char* name) {
+static JOYSTICKMAPPING
+jstkGetAxisMapping(float *value, const char* param, const char* name)
+{
if (sscanf(param, "%f", value)==0) {
if (param[0] == '-')
*value *= -1.0;
}
-if (strstr(param, "zx") != NULL)
+ if (strstr(param, "zx") != NULL)
return MAPPING_ZX;
else if (strstr(param, "zy") != NULL)
return MAPPING_ZY;
@@ -77,13 +78,14 @@
jstkParseButtonOption(const char* org,
JoystickDevPtr priv,
int number,
- const char* name) {
+ const char* name)
+{
char *param;
char *tmp;
int value;
float fvalue;
char p[64];
- struct BUTTON* button;
+ BUTTON* button;
button = &priv->button[number];
@@ -93,17 +95,18 @@
if (strcmp(param, "none") == 0) {
button->mapping = MAPPING_NONE;
} else if (sscanf(param, "button=%d", &value) == 1) {
- button->mapping = MAPPING_BUTTON;
- button->value = value;
+ button->mapping = MAPPING_BUTTON;
+ button->buttonnumber = value;
} else if (sscanf(param, "axis=%15s", p) == 1) {
button->mapping = jstkGetAxisMapping(&fvalue, p, name);
- button->value = (int)(fvalue*1000.0);
+ button->amplify = fvalue;
+ button->currentspeed = 1.0;
if (button->mapping == MAPPING_NONE)
xf86Msg(X_WARNING, "%s: error parsing axis: %s.\n",
name, p);
} else if (sscanf(param, "amplify=%f", &fvalue) == 1) {
button->mapping = MAPPING_SPEED_MULTIPLY;
- button->value = (int)(fvalue*1000.0);
+ button->amplify = fvalue;
} else if (sscanf(param, "key=%30s", p) == 1) {
char *current, *next;
current = p;
@@ -143,7 +146,8 @@
*/
void
-jstkParseAxisOption(const char* org, struct AXIS *axis, const char *name) {
+jstkParseAxisOption(const char* org, AXIS *axis, const char *name)
+{
char *param;
char *tmp;
int value;
@@ -157,9 +161,10 @@
p[15]='\0';
if (strcmp(p, "relative") == 0)
axis->type = TYPE_BYVALUE;
- else if (strcmp(p, "accelerated") == 0)
+ else if (strcmp(p, "accelerated") == 0) {
axis->type = TYPE_ACCELERATED;
- else if (strcmp(p, "absolute") == 0)
+ axis->currentspeed = 1.0;
+ } else if (strcmp(p, "absolute") == 0)
axis->type = TYPE_ABSOLUTE;
else if (strcmp(p, "none") == 0)
axis->type = TYPE_NONE;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-input-joystick-1.2.0/src/jstk_options.h new/xf86-input-joystick-1.2.1/src/jstk_options.h
--- old/xf86-input-joystick-1.2.0/src/jstk_options.h 2007-03-26 04:35:30.000000000 +0200
+++ new/xf86-input-joystick-1.2.1/src/jstk_options.h 2007-04-19 04:40:44.000000000 +0200
@@ -29,7 +29,7 @@
int number,
const char* name);
void jstkParseAxisOption(const char* org,
- struct AXIS *axis,
+ AXIS *axis,
const char* name);
#endif
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-input-joystick-1.2.0/src/linux_jstk.c new/xf86-input-joystick-1.2.1/src/linux_jstk.c
--- old/xf86-input-joystick-1.2.0/src/linux_jstk.c 2007-04-01 04:25:33.000000000 +0200
+++ new/xf86-input-joystick-1.2.1/src/linux_jstk.c 2007-04-19 04:40:44.000000000 +0200
@@ -21,6 +21,12 @@
*
*/
+/**
+ * This provides the backend for Linux joystick devices.
+ * Usable in FreeBSD with the linux_js module.
+ * Devices are usually /dev/input/js?
+ **/
+
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -28,6 +34,7 @@
#include
#include
+#include
#include
#include
#include
@@ -38,26 +45,28 @@
#include
#include "jstk.h"
-#include "linux_jstk.h"
+#include "jstk_hw.h"
/***********************************************************************
*
* jstkOpenDevice --
*
- * Open and initialize a joystick device
+ * Open and initialize a joystick device. The device name is
+ * taken from JoystickDevPtr
* Returns the filedescriptor, or -1 in case of error
*
***********************************************************************
*/
int
-jstkOpenDevice(JoystickDevPtr joystick,int init)
+jstkOpenDevice(JoystickDevPtr joystick)
{
char joy_name[128];
+ unsigned char axes, buttons;
int driver_version;
- if ((joystick->fd = open(joystick->device, O_RDWR | O_NDELAY, 0)) < 0) {
+ if ((joystick->fd = open(joystick->device, O_RDONLY | O_NDELAY, 0)) < 0) {
xf86Msg(X_ERROR, "Cannot open joystick '%s' (%s)\n", joystick->device,
strerror(errno));
return -1;
@@ -66,38 +75,44 @@
if (ioctl(joystick->fd, JSIOCGVERSION, &driver_version) == -1) {
xf86Msg(X_ERROR, "Joystick: ioctl on '%s' failed: %s\n", joystick->device,
strerror(errno));
+ close(joystick->fd);
+ joystick->fd = -1;
return -1;
}
- if ((driver_version >> 16) < 2) {
+ if ((driver_version >> 16) < 1) {
xf86Msg(X_WARNING, "Joystick: Driver version is only %d.%d.%d\n",
driver_version >> 16,
(driver_version >> 8) & 0xff,
driver_version & 0xff);
}
- if (ioctl(joystick->fd, JSIOCGAXES, &joystick->axes) == -1) {
+ if (ioctl(joystick->fd, JSIOCGAXES, &axes) == -1) {
xf86Msg(X_ERROR, "Joystick: ioctl on '%s' failed: %s\n", joystick->device,
strerror(errno));
+ close(joystick->fd);
+ joystick->fd = -1;
return -1;
}
- if (ioctl(joystick->fd, JSIOCGBUTTONS, &joystick->buttons) == -1) {
+
+ if (ioctl(joystick->fd, JSIOCGBUTTONS, &buttons) == -1) {
xf86Msg(X_ERROR, "Joystick: ioctl on '%s' failed: %s\n", joystick->device,
strerror(errno));
+ close(joystick->fd);
+ joystick->fd = -1;
return -1;
}
- /* Only show these information once, not every time the device is opened */
- if (init != 0) {
- if (ioctl(joystick->fd, JSIOCGNAME(128), joy_name) == -1) {
+ if (ioctl(joystick->fd, JSIOCGNAME(128), joy_name) == -1) {
xf86Msg(X_ERROR, "Joystick: ioctl on '%s' failed: %s\n",
joystick->device, strerror(errno));
- return -1;
- }
-
- xf86Msg(X_INFO, "Joystick: %s. %d buttons, %d axes\n",
- joy_name, joystick->axes, joystick->buttons);
+ close(joystick->fd);
+ joystick->fd = -1;
+ return -1;
}
+ xf86Msg(X_INFO, "Joystick: %s. %d axes, %d buttons\n",
+ joy_name, axes, buttons);
+
return joystick->fd;
}
@@ -135,7 +150,7 @@
int
jstkReadData(JoystickDevPtr joystick,
- enum JOYSTICKEVENT *event,
+ JOYSTICKEVENT *event,
int *number)
{
struct js_event js;
@@ -172,11 +187,5 @@
}
break;
}
-
- /* If it is an JS_EVENT_INIT just save the state, but don't report
- as an event */
- if ((js.type & JS_EVENT_INIT) == JS_EVENT_INIT) {
- if (event != NULL) *event = EVENT_NONE;
- }
return 1;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-input-joystick-1.2.0/src/linux_jstk.h new/xf86-input-joystick-1.2.1/src/linux_jstk.h
--- old/xf86-input-joystick-1.2.0/src/linux_jstk.h 2007-03-30 16:15:14.000000000 +0200
+++ new/xf86-input-joystick-1.2.1/src/linux_jstk.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,33 +0,0 @@
-/*
- * Copyright 2007 by Sascha Hlusiak.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * 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 name of Sascha Hlusiak not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Sascha Hlusiak makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * SASCHA HLUSIAK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL SASCHA HLUSIAK 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.
- *
- */
-
-#ifndef _LINUX_JSTK_H_INCLUDED_
-#define _LINUX_JSTK_H_INCLUDED_
-
-
-int jstkOpenDevice(JoystickDevPtr joystick, int init);
-void jstkCloseDevice(JoystickDevPtr joystick);
-int jstkReadData(JoystickDevPtr joystick,
- enum JOYSTICKEVENT *event, int *number);
-
-#endif
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-input-joystick-1.2.0/src/Makefile.am new/xf86-input-joystick-1.2.1/src/Makefile.am
--- old/xf86-input-joystick-1.2.0/src/Makefile.am 2007-03-26 23:37:55.000000000 +0200
+++ new/xf86-input-joystick-1.2.1/src/Makefile.am 2007-04-19 04:40:44.000000000 +0200
@@ -28,7 +28,20 @@
@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version
@DRIVER_NAME@_drv_ladir = @inputdir@
-@DRIVER_NAME@_drv_la_SOURCES = jstk.c jstk.h \
- linux_jstk.c linux_jstk.h \
+@DRIVER_NAME@_drv_la_SOURCES = jstk.c jstk.h jstk_hw.h \
jstk_axis.c jstk_axis.h \
jstk_options.c jstk_options.h
+
+BSD_SRCS = bsd_jstk.c
+LINUX_SRCS = linux_jstk.c
+
+if BSD
+@DRIVER_NAME@_drv_la_SOURCES += $(BSD_SRCS)
+@DRIVER_NAME@_drv_la_LDFLAGS += -lusbhid
+endif
+
+if LINUX
+@DRIVER_NAME@_drv_la_SOURCES += $(LINUX_SRCS)
+endif
+
+EXTRA_DIST = $(BSD_SRCS) $(LINUX_SRCS)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org