[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xserver-xorg-input-joystick: Changes to 'upstream-unstable'



 .gitignore                    |    4 
 Makefile.am                   |    8 -
 README                        |   20 ++++
 configure.ac                  |   26 ++++--
 include/joystick-properties.h |    4 
 man/.gitignore                |    3 
 man/joystick.man              |    8 +
 src/.gitignore                |    6 -
 src/Makefile.am               |    2 
 src/backend_bsd.c             |    6 -
 src/backend_evdev.c           |    4 
 src/backend_joystick.c        |    4 
 src/jstk.c                    |   27 +++---
 src/jstk.h                    |    4 
 src/jstk_axis.c               |  173 +++++++++++++++++++++++++++++++++++++++++-
 src/jstk_axis.h               |    1 
 src/jstk_key.c                |   26 +++++-
 src/jstk_options.c            |    2 
 src/jstk_properties.c         |   66 ++++++++++++++--
 19 files changed, 330 insertions(+), 64 deletions(-)

New commits:
commit 88a084952f547ebc2f30a257e441930024a69be9
Author: Sascha Hlusiak <saschahlusiak@arcor.de>
Date:   Tue Apr 14 22:33:01 2009 +0200

    Fail configure on xorg-server >= 1.6.99
    
    The 1.4 branch is broken on xorg-server >= 1.6.99. Use master instead.

diff --git a/configure.ac b/configure.ac
index 19fcf81..4ac344d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -72,7 +72,7 @@ XORG_DRIVER_CHECK_EXT(XKB, kbproto)
 
 # Checks for pkg-config packages
 PKG_CHECK_MODULES(XORG, 
-               [xorg-server >= 1.3.99.901] xproto $REQUIRED_MODULES)
+               [xorg-server >= 1.3.99.901 xorg-server <= 1.6.99] xproto $REQUIRED_MODULES)
 XORG_CFLAGS="$CWARNFLAGS $XORG_CFLAGS"
 xorg_sdkdir=$(pkg-config --variable=sdkdir xorg-server)
 AC_ARG_WITH(sdkdir,

commit 7d6a068c29e372747fc621020976797df9f61bac
Author: Sascha Hlusiak <saschahlusiak@arcor.de>
Date:   Tue Apr 14 22:25:49 2009 +0200

    Bump 1.4.1

diff --git a/configure.ac b/configure.ac
index d8e107b..19fcf81 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@
 
 AC_PREREQ(2.57)
 AC_INIT([xf86-input-joystick],
-        1.4.0,
+        1.4.1,
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         xf86-input-joystick)
 

commit e1710072396a97369ef71b1fd1738ad092a5e902
Author: Sascha Hlusiak <saschahlusiak@arcor.de>
Date:   Thu Mar 19 21:14:22 2009 +0100

    Fix compiler warning about stray INT8-CARD8 conversion

diff --git a/src/jstk_properties.c b/src/jstk_properties.c
index 837606c..f2c562a 100644
--- a/src/jstk_properties.c
+++ b/src/jstk_properties.c
@@ -197,7 +197,7 @@ jstkSetProperty(DeviceIntPtr pJstk, Atom atom, XIPropertyValuePtr val,
         CARD8 *values;
         if (val->size != priv->num_buttons || val->format != 8 || val->type != XA_INTEGER)
             return BadMatch;
-        values = (INT8*)val->data;
+        values = (CARD8*)val->data;
         for (i = 0; i<val->size; i++) {
             if (values[i] > BUTTONMAP_SIZE) {
                DBG(1, ErrorF("Button number out of range (0..%d): %d\n",

commit bc430cc2aacdcda45ddc38d457b84ff040be6a8c
Author: Sascha Hlusiak <saschahlusiak@arcor.de>
Date:   Thu Mar 19 21:08:30 2009 +0100

    Missing initialization of button amplify
    
    Always initialize button[]->amplify with 1.0

diff --git a/src/jstk.c b/src/jstk.c
index a5ea298..c747b40 100644
--- a/src/jstk.c
+++ b/src/jstk.c
@@ -561,6 +561,7 @@ jstkCorePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
         priv->button[i].mapping      = JSTK_MAPPING_NONE;
         priv->button[i].currentspeed = 1.0f;
         priv->button[i].subpixel     = 0.0f;
+        priv->button[i].amplify      = 1.0;
         for (j=0; j<MAXKEYSPERBUTTON; j++)
             priv->button[i].keys[j] = 0;
     }

commit 4b9aafd82bf78e86b2b2ddc78c37d73ccc7c25d5
Author: Sascha Hlusiak <saschahlusiak@arcor.de>
Date:   Wed Mar 18 18:13:12 2009 +0100

    Mention PWM mode in man page

diff --git a/man/joystick.man b/man/joystick.man
index 3199c07..03f9800 100644
--- a/man/joystick.man
+++ b/man/joystick.man
@@ -174,7 +174,11 @@ If
 .B mode
 is set to 
 .IR accelerated :
-One keydown event is generated, when the axis is moved out of the deadzone, the keyup event is generated, when the axis moves back to the deadzone. The keys will be autorepeated according to the keyboard settings.
+Keydown and keyup events will be generated repeatedly. The time between a keydown and a keyup event corresponds to the deflection of the axis.
+If the axis is deflected by 30%, the key will be considered to be down 300ms out of 1 second. The exact intervals may vary and can be adjusted with the
+.I amplify
+parameter. If the axis is deflected by 100%, there will only be one keydown event, so the key is considered down all the time.
+The keys will be autorepeated according to the Xorg keyboard settings.
 
 See special section about key events below.
 .TP 7

commit 6f2a211b7c3b45e8de9a90835fb7f1a24635c8e5
Author: Sascha Hlusiak <saschahlusiak@arcor.de>
Date:   Wed Mar 18 17:39:07 2009 +0100

    Fix build on FreeBSD with USB2
    
    Including dev/usb/usb_ioctl.h fixes missing declaration
    of USB_GET_REPORT_ID on FreeBSD-Current.

diff --git a/configure.ac b/configure.ac
index fc4627a..d8e107b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -101,6 +101,7 @@ AC_CHECK_HEADERS([usbhid.h dev/usb/usbhid.h],, [bsd_backend=no],
 AC_CHECK_LIB([usbhid],[hid_get_item],, [bsd_backend=no])
 AM_CONDITIONAL(BSD_BACKEND, [test "x$bsd_backend" = xyes])
 if test "x$bsd_backend" = xyes; then
+    AC_CHECK_HEADERS([dev/usb/usb_ioctl.h])
     AC_DEFINE(BSD_BACKEND, 1, [Compile BSD usbhid backend])
 fi
 
diff --git a/src/backend_bsd.c b/src/backend_bsd.c
index cf4cd90..60401b1 100644
--- a/src/backend_bsd.c
+++ b/src/backend_bsd.c
@@ -43,6 +43,9 @@
 #include <usbhid.h>
 #include <dev/usb/usb.h>
 #include <dev/usb/usbhid.h>
+#ifdef HAVE_DEV_USB_USB_IOCTL_H
+    #include <dev/usb/usb_ioctl.h>
+#endif
 
 #include "jstk.h"
 #include "backend_bsd.h"

commit c6217b5849b1c2680a9a8c29ca26b3468955b1c1
Author: Sascha Hlusiak <saschahlusiak@arcor.de>
Date:   Sun Mar 1 21:06:52 2009 +0100

    Comment float properties in joystick-properties.h
    
    Signed-off-by: Sascha Hlusiak <saschahlusiak@arcor.de>

diff --git a/include/joystick-properties.h b/include/joystick-properties.h
index 8dc5447..0f0d4ed 100644
--- a/include/joystick-properties.h
+++ b/include/joystick-properties.h
@@ -90,7 +90,7 @@ typedef enum _JSTK_MAPPING {
 #define JSTK_PROP_AXIS_MAPPING   "Axis Mapping"
 
 /** Set movement factor of axis (default 1.0f) */
-/* TODO float, movement amplify value per axis */
+/* FLOAT[MAXAXES], movement amplify per axis */
 #define JSTK_PROP_AXIS_AMPLIFY "Axis Amplify"
 
 /** Set KeySyms for axis in low position */
@@ -112,7 +112,7 @@ typedef enum _JSTK_MAPPING {
 #define JSTK_PROP_BUTTON_BUTTONNUMBER "Button Number"
 
 /** Set amplify factor of button (default 1.0f) */
-/* TODO float, button amplify value per button */
+/* FLOAT[MAXBUTTONS], amplify value per button */
 #define JSTK_PROP_BUTTON_AMPLIFY "Button Amplify"
 
 /** Set KeySyms for button */

commit 367c32bab57d69d85e95f4e76e2f1c8aaab45189
Author: Sascha Hlusiak <saschahlusiak@arcor.de>
Date:   Sun Mar 1 21:00:18 2009 +0100

    Support for float properties
    
    Signed-off-by: Sascha Hlusiak <saschahlusiak@arcor.de>

diff --git a/src/jstk_properties.c b/src/jstk_properties.c
index 98f85c5..837606c 100644
--- a/src/jstk_properties.c
+++ b/src/jstk_properties.c
@@ -30,6 +30,7 @@
 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 3
 
 
+
 #include <misc.h>
 #include <xf86.h>
 #include <X11/Xatom.h>
@@ -58,6 +59,11 @@ static Atom prop_button_amplify = 0;
 static Atom prop_button_keys = 0;
 
 
+#ifndef XATOM_FLOAT
+#define XATOM_FLOAT "FLOAT"
+#endif
+static Atom float_type = 0;
+
 
 static int
 jstkSetProperty(DeviceIntPtr pJstk, Atom atom, XIPropertyValuePtr val,
@@ -154,8 +160,17 @@ jstkSetProperty(DeviceIntPtr pJstk, Atom atom, XIPropertyValuePtr val,
         }
     }else if (atom == prop_axis_amplify)
     {
-        /* FIXME */
-        return BadValue;
+        float *values;
+        if (val->size != priv->num_axes || val->format != 32 || val->type != float_type)
+            return BadMatch;
+        if (!checkonly)
+        {
+            values = (float*)val->data;
+            for (i =0; i<val->size; i++) {
+                priv->axis[i].amplify = values[i];
+                DBG(1, ErrorF("Amplify of axis %d set to %.3f\n", i, priv->axis[i].amplify));
+            }
+        }
     }else if (atom == prop_axis_keys_low)
     {
         /* FIXME */
@@ -203,8 +218,17 @@ jstkSetProperty(DeviceIntPtr pJstk, Atom atom, XIPropertyValuePtr val,
         return Success;
     }else if (atom == prop_button_amplify)
     {
-        /* FIXME */
-        return BadValue;
+        float *values;
+        if (val->size != priv->num_buttons || val->format != 32 || val->type != float_type)
+            return BadMatch;
+        if (!checkonly)
+        {
+            values = (float*)val->data;
+            for (i =0; i<val->size; i++) {
+                priv->button[i].amplify = values[i];
+                DBG(1, ErrorF("Amplify of button %d set to %.3f\n", i, priv->button[i].amplify));
+            }
+        }
     }else if (atom == prop_button_keys)
     {
         /* FIXME */
@@ -221,10 +245,22 @@ jstkInitProperties(DeviceIntPtr pJstk, JoystickDevPtr priv)
     INT32 axes_values32[MAXAXES];
     INT8  axes_values8[MAXAXES];
     INT8  button_values8[MAXBUTTONS];
+    float axes_floats[MAXAXES];
+    float button_floats[MAXBUTTONS];
     int i;
 
     XIRegisterPropertyHandler(pJstk, jstkSetProperty, NULL, NULL);
 
+    float_type = XIGetKnownProperty(XATOM_FLOAT);
+    if (!float_type) {
+	float_type = MakeAtom(XATOM_FLOAT, strlen(XATOM_FLOAT), TRUE);
+	if (!float_type) {
+	    xf86Msg(X_WARNING, "%s: Failed to init float atom. "
+			       "Disabling support for float properties.\n", pJstk->name);
+	}
+    }
+
+
 #ifdef DEBUG
     /* Debug Level */
     prop_debuglevel = MakeAtom(JSTK_PROP_DEBUGLEVEL, strlen(JSTK_PROP_DEBUGLEVEL), TRUE);
@@ -300,7 +336,15 @@ jstkInitProperties(DeviceIntPtr pJstk, JoystickDevPtr priv)
     XISetDevicePropertyDeletable(pJstk, prop_axis_mapping, FALSE);
 
     /* priv->axis[].amplify */
-    /* FIXME: prop_axis_amplify as float[] */
+    if (float_type) {
+	for (i=0;i<priv->num_axes;i++)
+	    axes_floats[i] = priv->axis[i].amplify;
+	prop_axis_amplify = MakeAtom(JSTK_PROP_AXIS_AMPLIFY, strlen(JSTK_PROP_AXIS_AMPLIFY), TRUE);
+	XIChangeDeviceProperty(pJstk, prop_axis_amplify, float_type, 32,
+				PropModeReplace, priv->num_axes, axes_floats,
+				FALSE);
+	XISetDevicePropertyDeletable(pJstk, prop_axis_amplify, FALSE);
+    }
 
     /* priv->axis[].keys_low */
     /* FIXME: prop_axis_keys_low */
@@ -336,7 +380,15 @@ jstkInitProperties(DeviceIntPtr pJstk, JoystickDevPtr priv)
     XISetDevicePropertyDeletable(pJstk, prop_button_buttonnumber, FALSE);
 
     /* priv->button[].amplify */
-    /* FIXME: prop_button_amplify as float[] */
+    if (float_type) {
+	for (i=0;i<priv->num_buttons;i++)
+	    button_floats[i] = priv->button[i].amplify;
+	prop_button_amplify = MakeAtom(JSTK_PROP_BUTTON_AMPLIFY, strlen(JSTK_PROP_BUTTON_AMPLIFY), TRUE);
+	XIChangeDeviceProperty(pJstk, prop_button_amplify, float_type, 32,
+				PropModeReplace, priv->num_buttons, button_floats,
+				FALSE);
+	XISetDevicePropertyDeletable(pJstk, prop_button_amplify, FALSE);
+    }
 
     /* priv->button[].keys */
     /* FIXME: prop_button_keys */

commit 4978e78e7c49bc0aabf5c7ade4223c2529a9f046
Author: Sascha Hlusiak <saschahlusiak@arcor.de>
Date:   Thu Feb 19 23:40:58 2009 +0100

    Add PWM key generation when axis in accelerated mode
    
    When axis is in accelerated mode and keyhigh/keylow is set,
    the deflection of the axis will be linked to the _percent of time_ the key
    will be down. Full deflection will set the key permanently down (old behaviour).
    
    50% deflection will result in the key being  50ms down and 50ms up.
    75% deflection will result in the key being 150ms down and 50ms up.
    etc.
    Minimum interval is 50ms, maximum is 600ms.

diff --git a/src/jstk.c b/src/jstk.c
index a5ea298..155bf2c 100644
--- a/src/jstk.c
+++ b/src/jstk.c
@@ -283,20 +283,9 @@ jstkReadProc(LocalDevicePtr local)
 
             case JSTK_MAPPING_KEY: if (priv->keys_enabled == TRUE) {
                 if (priv->axis[number].type == JSTK_TYPE_ACCELERATED) {
-                    if ((priv->axis[number].value > 0) != 
-                        (priv->axis[number].oldvalue > 0))
-                        jstkGenerateKeys(priv->keyboard_device, 
-                                         priv->axis[number].keys_high,
-                                         (priv->axis[number].value > 0) ? 1:0);
-
-                    if ((priv->axis[number].value < 0) != 
-                        (priv->axis[number].oldvalue < 0))
-                        jstkGenerateKeys(priv->keyboard_device,
-                                         priv->axis[number].keys_low,
-                                         (priv->axis[number].value < 0) ? 1:0);
+                    jstkHandlePWMAxis(local, number);
                 } else if (priv->axis[number].type == JSTK_TYPE_BYVALUE) {
-                    if (priv->keys_enabled == TRUE)
-                        jstkStartAxisTimer(local, number);
+                    jstkStartAxisTimer(local, number);
                 }
                 break;
             }
@@ -449,6 +438,12 @@ jstkDeviceControlProc(DeviceIntPtr       pJstk,
             priv->timerrunning = FALSE;
             TimerCancel(priv->timer);
         }
+        for (i = 0; i < MAXAXES; i++)
+            if (priv->axis[i].timerrunning)
+        {
+            priv->axis[i].timerrunning = FALSE;
+            TimerCancel(priv->axis[i].timer);
+        }
 
         if (local->fd >= 0)
             RemoveEnabledDevice(local->fd);
@@ -552,6 +547,9 @@ jstkCorePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
         priv->axis[i].amplify      = 1.0f;
         priv->axis[i].valuator     = -1;
         priv->axis[i].subpixel     = 0.0f;
+        priv->axis[i].timer        = NULL;
+        priv->axis[i].timerrunning = FALSE;
+        priv->axis[i].key_isdown   = 0;
         for (j=0; j<MAXKEYSPERBUTTON; j++)
             priv->axis[i].keys_low[j] = priv->axis[i].keys_high[j] = 0;
     }
diff --git a/src/jstk.h b/src/jstk.h
index 694ae45..1d97937 100644
--- a/src/jstk.h
+++ b/src/jstk.h
@@ -81,7 +81,11 @@ typedef struct _AXIS {
     float           previousposition; /* TYPE_ABSOLUTE */
     float           amplify;
     float           subpixel; /* Pending subpixel movement */
+
     KEYSCANCODES    keys_low, keys_high;  /* MAPPING_KEY */
+    int             key_isdown;
+    OsTimerPtr      timer;
+    Bool            timerrunning;
 } AXIS;
 
 typedef struct _BUTTON {
diff --git a/src/jstk_axis.c b/src/jstk_axis.c
index 7e59e97..b314122 100644
--- a/src/jstk_axis.c
+++ b/src/jstk_axis.c
@@ -384,3 +384,170 @@ jstkHandleAbsoluteAxis(LocalDevicePtr device, int number)
         xf86PostMotionEvent(device->dev, 0, 0, 2, x, y);
     }
 }
+
+
+
+
+
+/***********************************************************************
+ *
+ * jstkPWMAxisTimer --
+ *
+ * The timer that will generate Key events.
+ * The deflection of the axis will control the PERCENT OF TIME the key is
+ * down, not the amount of impulses.
+ * Return 0, when timer can be stopped.
+ *
+ ***********************************************************************
+ */
+static CARD32
+jstkPWMAxisTimer(OsTimerPtr        timer,
+                 CARD32            atime,
+                 pointer           arg)
+{
+    DeviceIntPtr          device = (DeviceIntPtr)arg;
+    JoystickDevPtr        priv = (JoystickDevPtr)XI_PRIVATE(device);
+
+    int sigstate, i;
+    int nexttimer;
+
+    nexttimer = 0;
+
+    sigstate = xf86BlockSIGIO();
+
+    for (i=0; i<MAXAXES; i++)
+        if (priv->axis[i].timer == timer) /* The timer handles only one axis! Find it. */
+    {
+        AXIS *axis;
+        axis = &priv->axis[i];
+
+        DBG(8, ErrorF("PWM Axis %d value %d (old %d)\n", i, axis->value, axis->oldvalue));
+
+        /* Force key_high down if centered */
+        if ((axis->value <= 0) && 
+            (axis->oldvalue > 0) &&
+            (axis->key_isdown)) 
+        {
+            DBG(7, ErrorF("PWM Axis %d jumped over. Forcing keys_high up.\n", i));
+            jstkGenerateKeys(priv->keyboard_device, 
+                axis->keys_high,
+                0);
+            axis->key_isdown = 0;
+        }
+
+        /* Force key_low down if centered */
+        if ((axis->value >= 0) && 
+            (axis->oldvalue < 0) &&
+            (axis->key_isdown))
+        {
+            DBG(7, ErrorF("PWM Axis %d jumped over. Forcing keys_low up.\n", i));
+            jstkGenerateKeys(priv->keyboard_device, 
+                axis->keys_low,
+                0);
+            axis->key_isdown = 0;
+        }
+
+        if (axis->value == 0)
+            nexttimer = 0;
+        else {
+            float time_on, time_off;
+            float scale;
+            KEYSCANCODES *keys;
+
+            if (axis->value < 0)
+                keys = &axis->keys_low;
+            else keys = &axis->keys_high;
+
+            /* Calculate next timer */
+            time_on = (float)(abs(axis->value) - axis->deadzone) / 32768.0;
+            time_on *= (32768.0f / (float)(32768 - axis->deadzone));
+
+            time_off = 1.0f - time_on;
+
+            time_on  += 0.01f; /* Ugly but ensures we don't divide by 0 */
+            time_off += 0.01f;
+
+            /* Scale both durations, so the smaller always is 50ms */
+            scale = 50.0f * axis->amplify;
+
+            if (time_on < time_off)
+                scale /= time_on;
+            else scale /= time_off;
+
+            time_on  *= scale;
+            time_off *= scale;
+
+
+            if (time_off > 600.0f) {
+                /* Might as well just have it down forever */
+                DBG(7, ErrorF("PWM Axis %d up time too long (%.0fms). Forcing up)\n", i, time_off));
+                if (axis->key_isdown == 1) {
+                    axis->key_isdown = 0;
+                    jstkGenerateKeys(priv->keyboard_device,
+                        *keys,
+                        axis->key_isdown);
+                }
+                nexttimer = 0;
+            } else if (time_on > 600.0f) { 
+                /* Might as well just have it up forever */
+                DBG(7, ErrorF("PWM Axis %d down time too long (%.0fms). Forcing down)\n", i, time_on));
+                if (axis->key_isdown == 0) {
+                    axis->key_isdown = 1;
+                    jstkGenerateKeys(priv->keyboard_device,
+                        *keys,
+                        axis->key_isdown);
+                }
+                nexttimer = 0;
+            } else {
+                /* Flip key state */
+                axis->key_isdown = 1 - axis->key_isdown;
+                jstkGenerateKeys(priv->keyboard_device,
+                    *keys,
+                    axis->key_isdown);
+
+                DBG(7, ErrorF("PWM Axis %d state=%d (%.0fms down, %.0fms up).\n", i, axis->key_isdown, time_on, time_off));
+
+                nexttimer = axis->key_isdown ? (int)time_on : (int)time_off;
+            }
+        }
+
+        if (nexttimer == 0) { /* No next timer, stop */
+            axis->timerrunning = FALSE;
+
+            DBG(2, ErrorF("Stopping PWM Axis %d Timer\n", i));
+        }
+        axis->oldvalue = axis->value;
+        break;
+    }
+
+    xf86UnblockSIGIO (sigstate);
+    return nexttimer;
+}
+
+
+/***********************************************************************
+ *
+ * jstkStartAxisTimer --
+ *
+ * Starts the timer for the movement.
+ * Will already prepare for moving one pixel, for "tipping" the stick
+ *
+ ***********************************************************************
+ */
+void
+jstkHandlePWMAxis(LocalDevicePtr device, int number) 
+{
+    JoystickDevPtr priv = device->private;
+    if (priv->axis[number].timerrunning) return;
+
+    priv->axis[number].timerrunning = TRUE;
+
+    DBG(2, ErrorF("Starting PWM Axis Timer (triggered by axis %d, value %d)\n", 
+               number, priv->axis[number].value));
+    priv->axis[number].timer = TimerSet(
+        priv->axis[number].timer, 
+        0,         /* Relative */
+        1,         /* What about NOW? */
+        jstkPWMAxisTimer,
+        device->dev);
+}
diff --git a/src/jstk_axis.h b/src/jstk_axis.h
index e759f39..028c65f 100644
--- a/src/jstk_axis.h
+++ b/src/jstk_axis.h
@@ -27,5 +27,6 @@
 void jstkStartAxisTimer(LocalDevicePtr device, int number);
 void jstkStartButtonAxisTimer(LocalDevicePtr device, int number);
 void jstkHandleAbsoluteAxis(LocalDevicePtr device, int number);
+void jstkHandlePWMAxis(LocalDevicePtr device, int number);
 
 #endif

commit d4bb86ddb0ba570de0f501cd0edb13861456b711
Author: Sascha Hlusiak <saschahlusiak@arcor.de>
Date:   Thu Feb 19 23:37:46 2009 +0100

    Don't set axis.oldvalue in backend
    
    The value needs to be set where it's needed, like in timers.

diff --git a/src/backend_bsd.c b/src/backend_bsd.c
index cf4cd90..bf3dacb 100644
--- a/src/backend_bsd.c
+++ b/src/backend_bsd.c
@@ -264,7 +264,6 @@ jstkReadData_bsd(JoystickDevPtr joystick,
                          - bsddata->axis_item[j].logical_minimum);
         if (abs(d) < joystick->axis[j].deadzone) d = 0;
         if (d != joystick->axis[j].value) {
-            joystick->axis[j].oldvalue = joystick->axis[j].value;
             joystick->axis[j].value = d;
             if (event != NULL) *event = EVENT_AXIS;
             if (number != NULL) *number = j;
@@ -283,14 +282,12 @@ jstkReadData_bsd(JoystickDevPtr joystick,
         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].oldvalue = joystick->axis[a].value;
             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].oldvalue = joystick->axis[a+1].value;
             joystick->axis[a+1].value = v2_data[d];
             if (event != NULL) *event = EVENT_AXIS;
             if (number != NULL) *number = a+1;
diff --git a/src/backend_evdev.c b/src/backend_evdev.c
index d03efce..de061d3 100644
--- a/src/backend_evdev.c
+++ b/src/backend_evdev.c
@@ -281,15 +281,11 @@ jstkReadData_evdev(JoystickDevPtr joystick,
                 if (abs(value) < joystick->axis[axis->number].deadzone) {
                     /* We only want one event when in deadzone */
                     if (joystick->axis[axis->number].value != 0) {
-                        joystick->axis[axis->number].oldvalue = 
-                            joystick->axis[axis->number].value;
                         joystick->axis[axis->number].value = 0;
                         if (event != NULL) *event = EVENT_AXIS;
                         if (number != NULL) *number = axis->number;
                     }
                 }else{
-                    joystick->axis[axis->number].oldvalue = 
-                        joystick->axis[axis->number].value;
                     joystick->axis[axis->number].value = value;
                     if (event != NULL) *event = EVENT_AXIS;
                     if (number != NULL) *number = axis->number;
diff --git a/src/backend_joystick.c b/src/backend_joystick.c
index d8a0c3c..b69f932 100644
--- a/src/backend_joystick.c
+++ b/src/backend_joystick.c
@@ -193,15 +193,11 @@ jstkReadData_joystick(JoystickDevPtr joystick,
             if (abs(js.value) < joystick->axis[js.number].deadzone) {
                 /* We only want one event when in deadzone */
                 if (joystick->axis[js.number].value != 0) {
-                    joystick->axis[js.number].oldvalue = 
-                        joystick->axis[js.number].value;
                     joystick->axis[js.number].value = 0;
                     if (event != NULL) *event = EVENT_AXIS;
                     if (number != NULL) *number = js.number;
                 }
             }else{
-                joystick->axis[js.number].oldvalue = 
-                    joystick->axis[js.number].value;
                 joystick->axis[js.number].value = js.value;
                 if (event != NULL) *event = EVENT_AXIS;
                 if (number != NULL) *number = js.number;

commit 4ec4376522b1c393ee44f25adcd28b12d7cadff6
Author: Sascha Hlusiak <saschahlusiak@arcor.de>
Date:   Tue Feb 17 20:18:05 2009 +0100

    Fix for sparse warning of uninitialized variable
    
    If axis is inside deadzone, 0.0 should be assumed.

diff --git a/src/jstk_axis.c b/src/jstk_axis.c
index 233b2be..7e59e97 100644
--- a/src/jstk_axis.c
+++ b/src/jstk_axis.c
@@ -351,9 +351,11 @@ jstkHandleAbsoluteAxis(LocalDevicePtr device, int number)
     {
         float rel;
         int dif;
-        if (priv->axis[i].value > priv->axis[i].deadzone)
+        
+    	rel = 0.0f;
+        if (priv->axis[i].value > +priv->axis[i].deadzone)
             rel = (priv->axis[i].value - priv->axis[i].deadzone);
-        else
+        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));

commit b70b1f7d827b87ceb63110c781b01175363fb7d0
Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
Date:   Wed Feb 4 18:23:00 2009 -0200

    Janitor: gcc 4.5 and sparse warnings.
    
    It is still required a patch in the X Server sdk to correct some
    remaining warnings. Isn't it amazing that <X11/extensions/XKBsrv.h>
    and $sdkdir/xkbsrv.h both use the #ifndef _XKBSRV_H_ include guard?
    
    Signed-off-by: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>

diff --git a/src/jstk.c b/src/jstk.c
index 44acc48..a5ea298 100644
--- a/src/jstk.c
+++ b/src/jstk.c
@@ -519,7 +519,7 @@ jstkCorePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
     local->private = priv;
     local->type_name = XI_JOYSTICK;
     local->history_size = 0;
-    local->always_core_feedback = 0;
+    local->always_core_feedback = NULL;
     local->conf_idev = dev;
 
     priv->fd = -1;
diff --git a/src/jstk_axis.c b/src/jstk_axis.c
index 3c49bd3..233b2be 100644
--- a/src/jstk_axis.c
+++ b/src/jstk_axis.c
@@ -351,9 +351,9 @@ jstkHandleAbsoluteAxis(LocalDevicePtr device, int number)
     {
         float rel;
         int dif;
-        if (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)
+        else
             rel = (priv->axis[i].value + priv->axis[i].deadzone);
 
         rel = (rel) / (2.0f * (float)(32768 - priv->axis[i].deadzone));
diff --git a/src/jstk_key.c b/src/jstk_key.c
index 4e9f710..b2c5b5d 100644
--- a/src/jstk_key.c
+++ b/src/jstk_key.c
@@ -34,9 +34,14 @@
 #include <X11/keysym.h>
 #include <X11/XF86keysym.h>
 #include <xf86Optrec.h>
+
 #include "jstk.h"
 #include "jstk_key.h"
 
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 5
+#include <xkbsrv.h>
+#endif
+
 #define AltMask		Mod1Mask
 #define NumLockMask	Mod2Mask
 #define AltLangMask	Mod3Mask
@@ -70,7 +75,6 @@ jstkInitKeys(DeviceIntPtr pJstk, JoystickDevPtr priv)
     int i, j;
     XkbSrvInfoPtr xkbi;
     XkbControlsPtr ctrls;
-    XkbComponentNamesRec xkbnames;
 
     static struct { KeySym keysym; CARD8 mask; } modifiers[] = {
         { XK_Shift_L,           ShiftMask },
diff --git a/src/jstk_options.c b/src/jstk_options.c
index 309175e..8c0aba1 100644
--- a/src/jstk_options.c
+++ b/src/jstk_options.c
@@ -50,7 +50,7 @@
  ***********************************************************************
  */
 
-int
+static int
 jstkGetKeyNumberInMap(JoystickDevPtr priv,
                       KeySym keysym)
 {

commit 76b82a41a6733ef5a2a89dd370357320ea78792a
Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
Date:   Wed Feb 4 18:10:26 2009 -0200

    Janitor: make distcheck, .gitignore.
    
    The correction for make distcheck uses the same solution proposed
    for xf86-input-evdev, that uses the new configure option --with-sdkdir.
    
    Signed-off-by: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>

diff --git a/.gitignore b/.gitignore
index c96e99e..e5a79a1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
+.deps
+.libs
 Makefile
 Makefile.in
 *.la
@@ -18,7 +20,9 @@ ltmain.sh
 missing
 stamp-h1
 *~
+*.4
 xf86-input-joystick-*.tar.bz2
 xf86-input-joystick-*.tar.gz
 ChangeLog
 *.pc
+tags
diff --git a/Makefile.am b/Makefile.am
index bc41c7c..be8812f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,18 +19,18 @@
 #  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 AUTOMAKE_OPTIONS = foreign
+DISTCHECK_CONFIGURE_FLAGS = --with-sdkdir=\$${includedir}/xorg
 SUBDIRS = src man config include
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = xorg-joystick.pc
 
-EXTRA_DIST = autogen.sh ChangeLog
-
-CLEANFILES = ChangeLog
+EXTRA_DIST = ChangeLog
+MAINTAINERCLEANFILES = ChangeLog
 
 .PHONY: ChangeLog
 
 ChangeLog:
-	(GIT_DIR=$(top_srcdir)/.git git log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
+	$(CHANGELOG_CMD)
 
 dist-hook: ChangeLog
diff --git a/configure.ac b/configure.ac
index 45a021a..fc4627a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,15 +32,16 @@ AM_INIT_AUTOMAKE([dist-bzip2])
 
 AM_MAINTAINER_MODE
 
-DRIVER_NAME=joystick
-AC_SUBST([DRIVER_NAME])
-
+# Require xorg-macros: XORG_CWARNFLAGS, XORG_CHANGELOG
+m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.2 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.2)
 AM_CONFIG_HEADER([config.h])
 
 # Checks for programs.
 AC_DISABLE_STATIC
 AC_PROG_LIBTOOL
 AC_PROG_CC
+XORG_CWARNFLAGS
 
 AH_TOP([#include "xorg-server.h"])
 
@@ -72,12 +73,14 @@ XORG_DRIVER_CHECK_EXT(XKB, kbproto)
 # Checks for pkg-config packages
 PKG_CHECK_MODULES(XORG, 
                [xorg-server >= 1.3.99.901] xproto $REQUIRED_MODULES)
-sdkdir=$(pkg-config --variable=sdkdir xorg-server)
+XORG_CFLAGS="$CWARNFLAGS $XORG_CFLAGS"
+xorg_sdkdir=$(pkg-config --variable=sdkdir xorg-server)
+AC_ARG_WITH(sdkdir,
+	AC_HELP_STRING([--with-sdkdir=<path>],
+		[Xorg X Server sdk headers (default is autodetected)]),
+	[sdkdir="$withval"], [sdkdir="${xorg_sdkdir}"])
 AC_SUBST(sdkdir)
 
-CFLAGS="$CFLAGS $XORG_CFLAGS "' -I$(top_srcdir)/src'
-AC_SUBST([CFLAGS])
-
 # Checks for libraries.
 
 # Checks for header files.
@@ -110,8 +113,12 @@ fi
 
 AC_HEADER_STDC
 
+DRIVER_NAME=joystick
+AC_SUBST([DRIVER_NAME])
+
 XORG_MANPAGE_SECTIONS
 XORG_RELEASE_VERSION
+XORG_CHANGELOG
 
 AC_OUTPUT([Makefile
            src/Makefile
diff --git a/man/.gitignore b/man/.gitignore
deleted file mode 100644
index 62796a4..0000000
--- a/man/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-Makefile
-Makefile.in
-joystick.4*
diff --git a/src/.gitignore b/src/.gitignore
deleted file mode 100644
index 9730646..0000000
--- a/src/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.la
-*.lo
diff --git a/src/Makefile.am b/src/Makefile.am
index b30da44..fecb7e0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -24,6 +24,8 @@
 # -avoid-version prevents gratuitous .0.0.0 version numbers on the end
 # _ladir passes a dummy rpath to libtool so the thing will actually link
 # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
+AM_CFLAGS = $(XORG_CFLAGS)
+
 @DRIVER_NAME@_drv_la_LTLIBRARIES = @DRIVER_NAME@_drv.la
 @DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version
 @DRIVER_NAME@_drv_ladir = @inputdir@

commit 4671904035d4da4d112f53cce8781bcc77b0d0db
Author: Sascha Hlusiak <saschahlusiak@arcor.de>
Date:   Mon Feb 2 00:10:42 2009 +0100

    Use InitKeyboardDeviceStruct instead of nonexistant XkbInitKeyboardDeviceStruct
    
    Realizing XkbInitKeyboardDeviceStruct has been removed, we do need to use InitKeyboardDeviceStruct.
    This breaks custom keymaps on ABI_XINPUT_VERSION >= 5.
    
    Hopefully this can be reimplemented later.

diff --git a/src/jstk_key.c b/src/jstk_key.c
index ad5b3bd..4e9f710 100644
--- a/src/jstk_key.c
+++ b/src/jstk_key.c
@@ -109,11 +109,26 @@ jstkInitKeys(DeviceIntPtr pJstk, JoystickDevPtr priv)
         }
     }
 
-    XkbInitKeyboardDeviceStruct (pJstk, &xkbnames, &keySyms, modMap,
-            NULL, jstkKbdCtrl);
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 5
+    {
+        XkbRMLVOSet rmlvo;
+        XkbGetRulesDflts(&rmlvo);
+    	/* FIXME */
+	#warning KEYMAP FOR ABI_XINPUT_VERSION >= 5 BROKEN RIGHT NOW
+        if (!InitKeyboardDeviceStruct(pJstk, &rmlvo, NULL, jstkKbdCtrl))
+        {
+            ErrorF("unable to init keyboard device\n");
+            return !Success;
+        }
+    }
+#else
+    if (InitKeyboardDeviceStruct((DevicePtr)pJstk, &keySyms, modMap, NULL, jstkKbdCtrl) == FALSE) {
+	ErrorF("unable to init keyboard device\n");
+        return !Success;
+    }
+#endif
 
     /* Set Autorepeat and Delay */
-
     if ((priv->repeat_delay || priv->repeat_interval) && 
         pJstk->key && 
         pJstk->key->xkbInfo)

commit 3984947ada771619f21b511507a2fb9cca3ed645
Author: Alan Coopersmith <alan.coopersmith@sun.com>
Date:   Fri Jan 30 20:23:09 2009 -0800

    Add README with pointers to mailing list, bugzilla & git repos

diff --git a/README b/README
new file mode 100644
index 0000000..ce1e492
--- /dev/null
+++ b/README
@@ -0,0 +1,20 @@
+xf86-input-joystick - Joystick input driver for the Xorg X server
+
+Please submit bugs & patches to the Xorg bugzilla:
+
+        https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
+
+All questions regarding this software should be directed at the
+Xorg mailing list:
+
+        http://lists.freedesktop.org/mailman/listinfo/xorg
+
+The master development code repository can be found at:
+
+        git://anongit.freedesktop.org/git/xorg/driver/xf86-input-joystick


Reply to: