Author: dnusinow
Date: 2006-01-04 22:25:49 -0500 (Wed, 04 Jan 2006)
New Revision: 1009

Modified:
   trunk/debian/changelog
   trunk/debian/patches/freebsd/002_gnu-kbsd_wacom.diff
   trunk/debian/patches/general/000_stolen_from_linuxwacom_wacom_driver.diff
Log:
* Update general/000_stolen_from_linuxwacom_wacom_driver.diff to bring
  driver to 0.6.8. Also remove obsolete hunk from
  freebsd/002_gnu-kbsd_wacom.diff. (closes: #333496)


Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2006-01-05 03:03:34 UTC (rev 1008)
+++ trunk/debian/changelog      2006-01-05 03:25:49 UTC (rev 1009)
@@ -28,6 +28,9 @@
     (closes: #345893)
   * Remove obsolete warning about cpp in the xbase-clients description. Thanks
     Adrian Bunk. (closes: #345578)
+  * Update general/000_stolen_from_linuxwacom_wacom_driver.diff to bring
+    driver to 0.6.8. Also remove obsolete hunk from
+    freebsd/002_gnu-kbsd_wacom.diff. (closes: #333496)
   * Translation Updates:
     + Italian thanks to Danilo Piazzalunga. (closes: #345789)
 
@@ -38,7 +41,7 @@
     Perrier (closes: #345609).  While at it, added whitespace that made all
     the translations gain 1 fuzzy string.
 
- -- David Nusinow <[EMAIL PROTECTED]>  Wed,  4 Jan 2006 21:59:09 -0500
+ -- David Nusinow <[EMAIL PROTECTED]>  Wed,  4 Jan 2006 22:23:27 -0500
 
 xorg-x11 (6.9.0.dfsg.1-1) unstable; urgency=low
 

Modified: trunk/debian/patches/freebsd/002_gnu-kbsd_wacom.diff
===================================================================
--- trunk/debian/patches/freebsd/002_gnu-kbsd_wacom.diff        2006-01-05 
03:03:34 UTC (rev 1008)
+++ trunk/debian/patches/freebsd/002_gnu-kbsd_wacom.diff        2006-01-05 
03:25:49 UTC (rev 1009)
@@ -1,32 +1,15 @@
 $Id$
 
-One of the hunks in this patch is merged in upstream production release
-(0.6.8 at the time of this writing). The other is merged in upstream CVS
-(both production and development branches). This will have to be removed in
-the future when we catch up with upstream.
+This is merged in upstream CVS (both production and development branches).
+This will have to be removed in the future when we catch up with upstream.
 
 This patch by Robert Millan
 
-diff -ur xc.old/programs/Xserver/hw/xfree86/input/wacom/wcmCommon.c 
xc/programs/Xserver/hw/xfree86/input/wacom/wcmCommon.c
---- xc.old/programs/Xserver/hw/xfree86/input/wacom/wcmCommon.c 2005-07-18 
21:14:56.000000000 +0200
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmCommon.c     2005-07-18 
21:21:35.000000000 +0200
-@@ -825,7 +825,11 @@
-       if (pChannel->nSamples < 4) ++pChannel->nSamples;
- 
-       /* don't send the first sample due to the first USB package issue*/
--      if ( (pChannel->nSamples != 1) || (common->wcmDevCls != 
&gWacomUSBDevice) )
-+      if ( (pChannel->nSamples != 1)
-+#ifdef LINUX_INPUT
-+             || (common->wcmDevCls != &gWacomUSBDevice)
-+#endif
-+           )
-       {
-               commonDispatchDevice(common,channel,pChannel);
-               resetSampleCounter(pChannel);
-diff -ur xc.old/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.h 
xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.h
---- xc.old/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.h 2005-07-18 
21:14:56.000000000 +0200
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.h     2005-07-18 
21:21:35.000000000 +0200
-@@ -453,7 +453,7 @@
+Index: xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.h
+===================================================================
+--- xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.h.orig        
2006-01-04 22:15:07.000000000 -0500
++++ xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.h     2006-01-04 
22:19:59.000000000 -0500
+@@ -461,7 +461,7 @@
        int bufpos;                        /* position with buffer */
        unsigned char buffer[BUFFER_SIZE]; /* data read from device */
  

Modified: 
trunk/debian/patches/general/000_stolen_from_linuxwacom_wacom_driver.diff
===================================================================
--- trunk/debian/patches/general/000_stolen_from_linuxwacom_wacom_driver.diff   
2006-01-05 03:03:34 UTC (rev 1008)
+++ trunk/debian/patches/general/000_stolen_from_linuxwacom_wacom_driver.diff   
2006-01-05 03:25:49 UTC (rev 1009)
@@ -1,16 +1,25 @@
 $Id$
 
 This patch updates the wacom input driver from
-http://linuxwacom.sourceforge.net/ up to version 0.6.4.
+http://linuxwacom.sourceforge.net/ up to version 0.6.8.
 
-xf86Wacom.c tentatively brought up to 0.6.8 by David Nusinow
-
 This patch and changes to the Imakefile by Fabio M. Di Nitto.
+Updated to 0.6.8 by David Nusinow.
 
 Index: xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c
 ===================================================================
---- xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c.orig        
2005-12-24 16:43:08.000000000 -0500
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c     2005-12-24 
16:57:10.000000000 -0500
+--- xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c.orig        
2006-01-04 21:45:35.000000000 -0500
++++ xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c     2006-01-04 
22:14:58.000000000 -0500
+@@ -1,7 +1,7 @@
+-/* $XdotOrg: xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c,v 1.7 
2005/07/11 02:38:01 ajax Exp $ */
+ /* $XConsortium: xf86Wacom.c /main/20 1996/10/27 11:05:20 kaleb $ */
+ /*
+- * Copyright 1995-2001 by Frederic Lepied, France. <[EMAIL PROTECTED]>
++ * Copyright 1995-2002 by Frederic Lepied, France. <[EMAIL PROTECTED]> 
++ * Copyright 2002-2005 by Ping Cheng, Wacom Technology. <[EMAIL PROTECTED]>   
        
+  *                                                                            
+  * Permission to use, copy, modify, distribute, and sell this software and its
+  * documentation for any purpose is  hereby granted without fee, provided that
 @@ -23,10 +23,10 @@
   *
   */
@@ -6428,10 +6437,10 @@
 Index: xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.h
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.h     2005-12-24 
16:57:10.000000000 -0500
-@@ -0,0 +1,517 @@
++++ xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.h     2006-01-04 
22:15:07.000000000 -0500
+@@ -0,0 +1,525 @@
 +/*
-+ * Copyright 1995-2004 by Frederic Lepied, France. <[EMAIL PROTECTED]>
++ * Copyright 1995-2005 by Frederic Lepied, France. <[EMAIL PROTECTED]>
 + *                                                                            
 + * Permission to use, copy, modify, distribute, and sell this software and its
 + * documentation for any purpose is  hereby granted without fee, provided that
@@ -6561,6 +6570,7 @@
 +#define XI_STYLUS "STYLUS"      /* X device name for the stylus */
 +#define XI_CURSOR "CURSOR"      /* X device name for the cursor */
 +#define XI_ERASER "ERASER"      /* X device name for the eraser */
++#define XI_PAD    "PAD"         /* X device name for the I3 Pad */
 +#define MAX_VALUE 100           /* number of positions */
 +#define MAXTRY 3                /* max number of try to receive magic number 
*/
 +#define MAX_COORD_RES 1270.0    /* Resolution of the returned MaxX and MaxY */
@@ -6654,15 +6664,15 @@
 + * WacomDeviceRec
 + 
*****************************************************************************/
 +
-+#define DEVICE_ID(flags) ((flags) & 0x07)
++#define DEVICE_ID(flags) ((flags) & 0x0f)
 +
 +#define STYLUS_ID               1
 +#define CURSOR_ID               2
 +#define ERASER_ID               4
-+#define ABSOLUTE_FLAG           8
-+#define KEEP_SHAPE_FLAG         16
-+#define BAUD_19200_FLAG         32
-+#define BETA_FLAG               64
++#define PAD_ID                  8
++#define ABSOLUTE_FLAG           16
++#define KEEP_SHAPE_FLAG         32
++#define BAUD_19200_FLAG         64
 +#define BUTTONS_ONLY_FLAG       128
 +#define TPCBUTTONS_FLAG               256
 +#define TPCBUTTONONE_FLAG     512
@@ -6670,6 +6680,7 @@
 +#define IsCursor(priv) (DEVICE_ID((priv)->flags) == CURSOR_ID)
 +#define IsStylus(priv) (DEVICE_ID((priv)->flags) == STYLUS_ID)
 +#define IsEraser(priv) (DEVICE_ID((priv)->flags) == ERASER_ID)
++#define IsPad(priv)    (DEVICE_ID((priv)->flags) == PAD_ID)
 +
 +typedef int (*FILTERFUNC)(WacomDevicePtr pDev, WacomDeviceStatePtr pState);
 +
@@ -6679,7 +6690,7 @@
 +
 +#define FILTER_PRESSURE_RES 2048        /* maximum points in pressure curve */
 +
-+typedef enum { TV_NONE = 0, TV_ABOVE_BELOW = 1, TV_LEFT_RIGHT = 2 } tvMode;
++typedef enum { TV_NONE = 0, TV_ABOVE_BELOW = 1, TV_LEFT_RIGHT = 2 } tvMode;
 +
 +struct _WacomDeviceRec
 +{
@@ -6698,6 +6709,8 @@
 +      WacomCommonPtr common;  /* common info pointer */
 +    
 +      /* state fields */
++      int currentX;           /* current X position */
++      int currentY;           /* current Y position */
 +      int oldX;               /* previous X position */
 +      int oldY;               /* previous Y position */
 +      int oldZ;               /* previous pressure */
@@ -6705,6 +6718,8 @@
 +      int oldTiltY;           /* previous tilt in y direction */    
 +      int oldWheel;           /* previous wheel value */    
 +      int oldRot;             /* previous rotation value */
++      int oldStripX;          /* previous left strip value */
++      int oldStripY;          /* previous right strip value */
 +      int oldThrottle;        /* previous throttle value */
 +      int oldButtons;         /* previous buttons state */
 +      int oldProximity;       /* previous proximity */
@@ -6757,6 +6772,8 @@
 +      int pressure;
 +      int tiltx;
 +      int tilty;
++      int stripx;
++      int stripy;
 +      int rotation;
 +      int abswheel;
 +      int relwheel;
@@ -6950,7 +6967,7 @@
 Index: xc/programs/Xserver/hw/xfree86/input/wacom/Xwacom.h
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/Xwacom.h        2005-12-24 
16:57:10.000000000 -0500
++++ xc/programs/Xserver/hw/xfree86/input/wacom/Xwacom.h        2006-01-04 
22:15:07.000000000 -0500
 @@ -0,0 +1,48 @@
 +/*****************************************************************************
 + *
@@ -7003,10 +7020,10 @@
 Index: xc/programs/Xserver/hw/xfree86/input/wacom/wcmCommon.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmCommon.c     2005-12-24 
16:57:10.000000000 -0500
-@@ -0,0 +1,1084 @@
++++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmCommon.c     2006-01-04 
22:14:58.000000000 -0500
+@@ -0,0 +1,1081 @@
 +/*
-+ * Copyright 1995-2004 by Frederic Lepied, France. <[EMAIL PROTECTED]>
++ * Copyright 1995-2005 by Frederic Lepied, France. <[EMAIL PROTECTED]>
 + *
 + * Permission to use, copy, modify, distribute, and sell this software and its
 + * documentation for any purpose is  hereby granted without fee, provided that
@@ -7016,8 +7033,8 @@
 + * advertising or publicity pertaining to distribution of the software without
 + * specific,  written      prior  permission.     Frederic  Lepied   makes  no
 + * representations about the suitability of this software for any purpose.  It
-+ * is provided "as is" without express or implied warranty.              
-+ *                                                                        
++ * is provided "as is" without express or implied warranty.
++ *
 + * FREDERIC  LEPIED DISCLAIMS ALL   WARRANTIES WITH REGARD  TO  THIS SOFTWARE,
 + * INCLUDING ALL IMPLIED   WARRANTIES OF MERCHANTABILITY  AND   FITNESS, IN NO
 + * EVENT  SHALL FREDERIC  LEPIED BE   LIABLE   FOR ANY  SPECIAL, INDIRECT   OR
@@ -7062,17 +7079,25 @@
 + *   combined horizontal and vertical setups
 + ****************************************************************************/
 +
-+static void xf86WcmSetScreen(LocalDevicePtr local, int *v0, int *v1)
++static void xf86WcmSetScreen(LocalDevicePtr local, int *value0, int *value1)
 +{
 +      WacomDevicePtr priv = (WacomDevicePtr) local->private;
 +      int screenToSet = 0;
 +      int totalWidth = 0, maxHeight = 0, leftPadding = 0;
-+      int i, x, y;
++      int i, x, y, v0 = *value0, v1 = *value1;
 +      double sizeX = priv->bottomX - priv->topX - 2*priv->tvoffsetX;
 +      double sizeY = priv->bottomY - priv->topY - 2*priv->tvoffsetY;
 +
-+      DBG(6, ErrorF("xf86WcmSetScreen\n"));
++      DBG(6, ErrorF("xf86WcmSetScreen v0=%d v1=%d\n", *value0, *value1));
 +
++      if (priv->twinview == TV_NONE && (priv->flags & ABSOLUTE_FLAG))
++      {
++              v0 = v0 > priv->bottomX ? priv->bottomX - priv->topX :
++                      v0 < priv->topX ? 0 : v0 - priv->topX;
++              v1 = v1 > priv->bottomY ? priv->bottomY - priv->topY :
++                      v1 < priv->topY ? 0 : v1 - priv->topY;
++      }
++
 +      /* set factorX and factorY for single screen setup since
 +       * Top X Y and Bottom X Y can be changed while driver is running
 +       */
@@ -7084,16 +7109,16 @@
 +                      {
 +                              if (priv->twinview == TV_LEFT_RIGHT)
 +                              {
-+                                      if (*v0 > priv->bottomX - 
priv->tvoffsetX && *v0 <= priv->bottomX)
++                                      if (v0 > priv->bottomX - 
priv->tvoffsetX && v0 <= priv->bottomX)
 +                                              priv->currentScreen = 1;
-+                                      if (*v0 > priv->topX && *v0 <= 
priv->topX + priv->tvoffsetX)
++                                      if (v0 > priv->topX && v0 <= priv->topX 
+ priv->tvoffsetX)
 +                                              priv->currentScreen = 0;
 +                              }
 +                              if (priv->twinview == TV_ABOVE_BELOW)
 +                              {
-+                                      if (*v1 > priv->bottomY - 
priv->tvoffsetY && *v1 <= priv->bottomY)
++                                      if (v1 > priv->bottomY - 
priv->tvoffsetY && v1 <= priv->bottomY)
 +                                              priv->currentScreen = 1;
-+                                      if (*v1 > priv->topY && *v1 <= 
priv->topY + priv->tvoffsetY)
++                                      if (v1 > priv->topY && v1 <= priv->topY 
+ priv->tvoffsetY)
 +                                              priv->currentScreen = 0;
 +                              }
 +                      }
@@ -7104,7 +7129,7 @@
 +              }
 +              else
 +              {
-+                      /* puck is on the tablet when driver starts */
++                      /* tool on the tablet when driver starts */
 +                      if (miPointerCurrentScreen())
 +                              priv->currentScreen = 
miPointerCurrentScreen()->myNum;
 +                      priv->factorX = 
screenInfo.screens[priv->currentScreen]->width / sizeX;
@@ -7136,7 +7161,7 @@
 +      {
 +              for (i = 0; i < priv->numScreen; i++)
 +              {
-+                      if (*v0 * totalWidth <= (leftPadding + 
++                      if (v0 * totalWidth <= (leftPadding + 
 +                              screenInfo.screens[i]->width) * sizeX)
 +                      {
 +                              screenToSet = i;
@@ -7151,10 +7176,10 @@
 +              screenToSet = priv->screen_no;
 +              for (i = 0; i < screenToSet; i++)
 +                      leftPadding += screenInfo.screens[i]->width;
-+              *v0 = (sizeX * leftPadding + *v0
++              v0 = (sizeX * leftPadding + v0
 +                      * screenInfo.screens[screenToSet]->width) /
 +                      (double)totalWidth + 0.5;
-+              *v1 = *v1 * screenInfo.screens[screenToSet]->height /
++              v1 = v1 * screenInfo.screens[screenToSet]->height /
 +                      (double)maxHeight + 0.5;
 +      }
 +
@@ -7162,9 +7187,9 @@
 +      {
 +              priv->factorX = totalWidth/sizeX;
 +              priv->factorY = maxHeight/sizeY;
-+              x = (*v0 - sizeX
++              x = (v0 - sizeX
 +                      * leftPadding / totalWidth) * priv->factorX + 0.5;
-+              y = *v1 * priv->factorY + 0.5;
++              y = v1 * priv->factorY + 0.5;
 +              
 +              if (x >= screenInfo.screens[screenToSet]->width)
 +                      x = screenInfo.screens[screenToSet]->width - 1;
@@ -7175,15 +7200,15 @@
 +#endif
 +      {
 +              if (priv->screen_no == -1)
-+                      *v0 = (*v0 * totalWidth - sizeX * leftPadding)
++                      v0 = (v0 * totalWidth - sizeX * leftPadding)
 +                              / screenInfo.screens[screenToSet]->width;
 +              else
 +                      screenToSet = priv->screen_no;
 +              priv->factorX = screenInfo.screens[screenToSet]->width / sizeX;
 +              priv->factorY = screenInfo.screens[screenToSet]->height / sizeY;
 +
-+              x = *v0 * priv->factorX + 0.5;
-+              y = *v1 * priv->factorY + 0.5;
++              x = v0 * priv->factorX + 0.5;
++              y = v1 * priv->factorY + 0.5;
 +      }
 +
 +      xf86XInputSetScreen(local, screenToSet, x, y);
@@ -7208,7 +7233,7 @@
 +      DBG(6, ErrorF("xf86WcmSendButtons buttons=%d for %s\n", buttons, 
local->name));
 +
 +      /* Tablet PC buttons. */
-+      if ( common->wcmTPCButton && !IsCursor(priv))
++      if ( common->wcmTPCButton && !IsCursor(priv) && !IsPad(priv) )
 +      {
 +              if ( buttons & 1 )
 +              {
@@ -7402,49 +7427,31 @@
 +
 +      WacomDevicePtr priv = (WacomDevicePtr) local->private;
 +      WacomCommonPtr common = priv->common;
-+      int rx, ry, rz, rtx, rty, rrot, rth, rw;
-+      int is_core_pointer, is_absolute, doffsetX=0, doffsetY=0;
-+      int aboveBelowSwitch = (priv->twinview == TV_ABOVE_BELOW)
-+              ? ((y < priv->topY) ? -1 : ((priv->bottomY < y) ? 1 : 0)) : 0;
-+      int leftRightSwitch = (priv->twinview == TV_LEFT_RIGHT)
-+              ? ((x < priv->topX) ? -1 : ((priv->bottomX < x) ? 1 : 0)) : 0;
++      int rx, ry, rz, rtx, rty, rrot, rth, rw, no_jitter;
++      double param, relacc;
++      int is_core_pointer, is_absolute;
 +
++      /* use tx and ty to report stripx and stripy */
++      if (type == PAD_ID)
++      {
++              tx = ds->stripx;
++              ty = ds->stripy;
++      }
++
 +      DBG(7, ErrorF("[%s] prox=%s x=%d y=%d z=%d "
 +              "b=%s b=%d tx=%d ty=%d wl=%d rot=%d th=%d\n",
 +              (type == STYLUS_ID) ? "stylus" :
-+                      (type == CURSOR_ID) ? "cursor" : "eraser",
++                      (type == CURSOR_ID) ? "cursor" : 
++                      (type == ERASER_ID) ? "eraser" : "pad",
 +              is_proximity ? "true" : "false",
 +              x, y, z, is_button ? "true" : "false", buttons,
 +              tx, ty, wheel, rot, throttle));
 +
 +      is_absolute = (priv->flags & ABSOLUTE_FLAG);
 +      is_core_pointer = xf86IsCorePointer(local->dev);
++      priv->currentX = x;
++      priv->currentY = y;
 +
-+      if ( is_proximity || x || y || z || buttons || tx || ty || wheel )
-+      {
-+              switch ( leftRightSwitch )
-+              {
-+                      case -1:
-+                              doffsetX = 0;
-+                              break;
-+                      case 1:
-+                              doffsetX = priv->bottomX - priv->topX - 
2*priv->tvoffsetX;
-+                              break;
-+              }
-+              switch ( aboveBelowSwitch )
-+              {
-+                      case -1:
-+                              doffsetY = 0;
-+                              break;
-+                      case 1:
-+                              doffsetY = priv->bottomY - priv->topY - 
2*priv->tvoffsetY;
-+                              break;
-+              }
-+      }
-+
-+      x += doffsetX;
-+      y += doffsetY;
-+
 +      DBG(6, ErrorF("[%s] %s prox=%d\tx=%d\ty=%d\tz=%d\t"
 +              "button=%s\tbuttons=%d\t on channel=%d\n",
 +              local->name,
@@ -7456,18 +7463,8 @@
 +      /* sets rx and ry according to the mode */
 +      if (is_absolute)
 +      {
-+              if (priv->twinview == TV_NONE)
-+              {
-+                      rx = x > priv->bottomX ? priv->bottomX - priv->topX :
-+                              x < priv->topX ? 0 : x - priv->topX;
-+                      ry = y > priv->bottomY ? priv->bottomY - priv->topY :
-+                              y < priv->topY ? 0 : y - priv->topY;
-+              }
-+              else
-+              {
-+                      rx = x;
-+                      ry = y;
-+              }
++              rx = x;
++              ry = y;
 +              rz = z;
 +              rtx = tx;
 +              rty = ty;
@@ -7481,6 +7478,8 @@
 +              {
 +                      /* unify acceleration in both directions */
 +                      rx = (x - priv->oldX) * priv->factorY / priv->factorX;
++
++                      rx = (x - priv->oldX);
 +                      ry = y - priv->oldY;
 +              }
 +              else
@@ -7488,10 +7487,10 @@
 +                      rx = 0;
 +                      ry = 0;
 +              }
++
 +              /* don't apply speed for fairly small increments */
-+              int no_jitter = priv->speed * 3;
-+              double param;
-+              double relacc = (MAX_ACCEL-priv->accel)*(MAX_ACCEL-priv->accel);
++              no_jitter = priv->speed * 3;
++              relacc = (MAX_ACCEL-priv->accel)*(MAX_ACCEL-priv->accel);
 +              if (ABS(rx) > no_jitter)
 +              {
 +                      param = priv->speed;
@@ -7531,7 +7530,7 @@
 +
 +      /* for multiple monitor support, we need to set the proper 
 +       * screen and modify the axes before posting events */
-+      if( !((priv->flags & BUTTONS_ONLY_FLAG) || channel) )
++      if( !(priv->flags & BUTTONS_ONLY_FLAG) )
 +      {
 +              xf86WcmSetScreen(local, &rx, &ry);
 +      }
@@ -7553,13 +7552,8 @@
 +                                      rw);
 +              }
 +
-+              /* don't move the cursor if it only supports buttons or
-+               * if it's the second tool in dual input case.
-+               * More complicated dual input, such as only sylus/puck moves 
-+               * the cursor or both tools can move the cursor will be 
-+               * supported when needed
-+               */
-+              if( !((priv->flags & BUTTONS_ONLY_FLAG) || channel) )
++              /* don't move the cursor if it only supports buttons */
++              if( !(priv->flags & BUTTONS_ONLY_FLAG) )
 +              {
 +                      if (IsCursor(priv))
 +                              xf86PostMotionEvent(local->dev,
@@ -7584,13 +7578,13 @@
 +                      int i;
 +                      for (i=0; i<abs(ds->relwheel); i++)
 +                      {
-+                              xf86PostButtonEvent(local->dev, 
++                              xf86PostButtonEvent(local->dev,
 +                                      is_absolute,
-+                                      fakeButton, 1, 0, 6, rx, ry, rz, 
++                                      fakeButton, 1, 0, 6, rx, ry, rz,
 +                                      rrot, rth, rw);
-+                              xf86PostButtonEvent(local->dev, 
++                              xf86PostButtonEvent(local->dev,
 +                                      is_absolute,
-+                                      fakeButton, 0, 0, 6, rx, ry, rz, 
++                                      fakeButton, 0, 0, 6, rx, ry, rz,
 +                                      rrot, rth, rw);
 +                      }
 +              }
@@ -7614,10 +7608,8 @@
 +                      {
 +                              int macro = z / 2;
 +
-+                              DBG(6, ErrorF("macro=%d buttons=%d "
-+                                      "wacom_map[%d]=%lx\n",
-+                                      macro, buttons, macro,
-+                                      gWacomModule.keymap[macro]));
++                              DBG(6, ErrorF("macro=%d buttons=%d \n",
++                                      macro, buttons));
 +
 +                              /* First available Keycode begins at 8
 +                               * therefore macro+7 */
@@ -7667,6 +7659,8 @@
 +      priv->oldZ = z;
 +      priv->oldTiltX = tx;
 +      priv->oldTiltY = ty;
++      priv->oldStripX = ds->stripx;
++      priv->oldStripY = ds->stripy;
 +      priv->oldRot = rot;
 +      priv->oldThrottle = throttle;
 +}
@@ -7686,11 +7680,15 @@
 +      if (dsOrig->proximity != dsNew->proximity) return 0;
 +      if (ABS(dsOrig->x - dsNew->x) > suppress) return 0;
 +      if (ABS(dsOrig->y - dsNew->y) > suppress) return 0;
++      if (ABS(dsOrig->tiltx - dsNew->tiltx) > suppress) return 0;
++      if (ABS(dsOrig->tilty - dsNew->tilty) > suppress) return 0;
++      if (ABS(dsOrig->stripx - dsNew->stripx) > suppress) return 0;
++      if (ABS(dsOrig->stripy - dsNew->stripy) > suppress) return 0;
 +      if (ABS(dsOrig->pressure - dsNew->pressure) > suppress) return 0;
 +      if (ABS(dsOrig->throttle - dsNew->throttle) > suppress) return 0;
 +
-+      if ((1800 + dsOrig->rotation - dsNew->rotation) % 1800 > suppress &&
-+              (1800 + dsNew->rotation - dsOrig->rotation) % 1800 > suppress)
++      if (ABS(dsOrig->rotation - dsNew->rotation) > suppress ||
++              (1800 - ABS(dsNew->rotation - dsOrig->rotation)) > suppress)
 +              return 0;
 +
 +      /* look for change in absolute wheel
@@ -7760,6 +7758,14 @@
 +      WacomDeviceState ds;
 +      WacomChannelPtr pChannel;
 +
++      /* tool on the tablet when driver starts */
++      if (!miPointerCurrentScreen())
++      {
++              DBG(6, ErrorF("xf86WcmEvent: Wacom driver can not get Current 
Screen ID\n"));
++              DBG(6, ErrorF("Please remove Wacom tool from the tablet.\n"));
++              return;
++      }
++
 +      /* sanity check the channel */
 +      if (channel >= MAX_CHANNELS)
 +              return;
@@ -7785,9 +7791,19 @@
 +              ds.tilty, ds.abswheel, ds.relwheel, ds.throttle,
 +              ds.discard_first, ds.proximity, ds.sample));
 +
-+      DBG(11, ErrorF("filter %d, %p\n",RAW_FILTERING(common),
-+              (void *)common->wcmModel->FilterRaw));
-+
++#ifdef LINUX_INPUT
++      /* Discard the first 2 USB packages due to events delay */
++      if ( (pChannel->nSamples < 2) && (common->wcmDevCls == 
&gWacomUSBDevice) )
++      {
++              DBG(11, ErrorF("discarded %dth USB data.\n", 
pChannel->nSamples));
++              /* store channel device state for later use */
++              memmove(pChannel->valid.states + 1,
++                      pChannel->valid.states,
++                      sizeof(WacomDeviceState) * (MAX_SAMPLES - 1));
++              ++pChannel->nSamples;
++              return; /* discard */
++      }
++#endif
 +      /* Filter raw data, fix hardware defects, perform error correction */
 +      if (RAW_FILTERING(common) && common->wcmModel->FilterRaw)
 +      {
@@ -7800,7 +7816,7 @@
 +      }
 +
 +      /* Discard unwanted data */
-+      if (xf86WcmSuppress(common->wcmSuppress, pLast, &ds) && 
pChannel->nSamples == 4)
++      if (xf86WcmSuppress(common->wcmSuppress, pLast, &ds) && 
pChannel->rawFilter.npoints == 4)
 +      {
 +              /* If throttle is not in use, discard data. */
 +              if (ABS(ds.throttle) < common->wcmSuppress)
@@ -7829,14 +7845,10 @@
 +              pChannel->valid.states,
 +              sizeof(WacomDeviceState) * (MAX_SAMPLES - 1));
 +      pChannel->valid.state = ds; /*save last raw sample */
-+      if (pChannel->nSamples < 4) ++pChannel->nSamples;
++      if (pChannel->rawFilter.npoints < 4) ++pChannel->nSamples;
 +
-+      /* don't send the first sample due to the first USB package issue*/
-+      if ( (pChannel->nSamples != 1) || (common->wcmDevCls != 
&gWacomUSBDevice) )
-+      {
-+              commonDispatchDevice(common,channel,pChannel);
-+              resetSampleCounter(pChannel);
-+      }
++      commonDispatchDevice(common,channel,pChannel);
++      resetSampleCounter(pChannel);
 +}
 +
 +static void commonDispatchDevice(WacomCommonPtr common, unsigned int channel,
@@ -7845,12 +7857,27 @@
 +      int id, idx;
 +      WacomDevicePtr priv;
 +      LocalDevicePtr pDev = NULL;
-+      LocalDevicePtr pLastDev = pChannel->pDev;
 +      WacomDeviceState* ds = &pChannel->valid.states[0];
-+      WacomDeviceState* pLast = &pChannel->valid.states[1];
 +
 +      DBG(10, ErrorF("commonDispatchEvents\n"));
 +
++      if (!ds->device_type)
++      {
++              /* defaults to cursor if tool is on the tablet when X starts */
++              ds->device_type = CURSOR_ID;
++              ds->proximity = 1;
++              if (ds->serial_num)
++                      for (idx=0; idx<common->wcmNumDevices; idx++)
++                      {
++                              priv = common->wcmDevices[idx]->private;
++                              if (ds->serial_num == priv->serial)
++                              {
++                                      ds->device_type = 
DEVICE_ID(priv->flags);
++                                      break;
++                              }
++                      }
++      }
++
 +      /* Find the device the current events are meant for */
 +      for (idx=0; idx<common->wcmNumDevices; idx++)
 +      {
@@ -7860,34 +7887,15 @@
 +              if (id == ds->device_type &&
 +                      ((!priv->serial) || (ds->serial_num == priv->serial)))
 +              {
-+                      if ((priv->topX <= ds->x && priv->bottomX > ds->x &&
-+                              priv->topY <= ds->y && priv->bottomY > ds->y))
-+                      {
-+                              DBG(11, ErrorF("tool id=%d for %s\n",
++                      DBG(11, ErrorF("tool id=%d for %s\n",
 +                                      id, common->wcmDevices[idx]->name));
-+                              pDev = common->wcmDevices[idx];
-+                              break;
-+                      }
-+                      /* Fallback to allow the cursor to move
-+                       * smoothly along screen edges */
-+                      else if (priv->oldProximity)
-+                      {
-+                              pDev = common->wcmDevices[idx];
-+                      }
++                      pDev = common->wcmDevices[idx];
++                      break;
 +              }
 +      }
 +
-+      DBG(11, ErrorF("commonDispatchEvents: %p %p\n",(void *)pDev,(void 
*)pLastDev));
++      DBG(11, ErrorF("commonDispatchEvents: %p \n",(void *)pDev));
 +
-+      /* if the logical device of the same physical tool has changed,
-+       * send proximity out to the previous one */
-+      if (pLastDev && (pLastDev != pDev) &&
-+              (pLast->serial_num == ds->serial_num))
-+      {
-+              pLast->proximity = 0;
-+              xf86WcmSendEvents(pLastDev, pLast, channel);
-+      }
-+
 +      /* if a device matched criteria, handle filtering per device
 +       * settings, and send event to XInput */
 +      if (pDev)
@@ -7899,7 +7907,7 @@
 +
 +              /* button 1 Threshold test */
 +              int button = 1;
-+              if ( !IsCursor(priv) )
++              if ( IsStylus(priv) || IsEraser(priv))
 +              {
 +                      if (filtered.pressure < common->wcmThreshold )
 +                              filtered.buttons &= ~button;
@@ -7956,14 +7964,20 @@
 +
 +              #endif /* throttle */
 +
-+              /* force out-prox when height is greater than 112. 
-+               * This only applies to USB protocol V tablets
++              /* force out-prox when height is greater than 13 
++               * (use 112 for history reason for now) for GD & XD;
++               * 28 for PTZ. This only applies to USB protocol V tablets
 +               * which aimed at improving relative movement support. 
 +               */
-+              if (filtered.distance > 112 && !(priv->flags & ABSOLUTE_FLAG) 
&& !channel )
++              if (!(priv->flags & ABSOLUTE_FLAG) && IsCursor(priv))
 +              {
-+                      ds->proximity = 0;
-+                      filtered.proximity = 0;
++                      DBG(11, ErrorF("Distance over the tablet: %d \n", 
filtered.distance));
++                      if ((filtered.distance > 28 && 
strstr(common->wcmModel->name, "Intuos3")) 
++                      || (filtered.distance > 112 && 
!strstr(common->wcmModel->name, "Intuos3")) )
++                      {
++                              ds->proximity = 0;
++                              filtered.proximity = 0;
++                      }
 +              }
 +
 +              xf86WcmSendEvents(pDev, &filtered, channel);
@@ -8092,7 +8106,7 @@
 Index: xc/programs/Xserver/hw/xfree86/input/wacom/wcmCompat.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmCompat.c     2005-12-24 
16:57:10.000000000 -0500
++++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmCompat.c     2006-01-04 
22:14:58.000000000 -0500
 @@ -0,0 +1,46 @@
 +/*
 + * Copyright 1995-2004 by Frederic Lepied, France. <[EMAIL PROTECTED]>
@@ -8143,10 +8157,11 @@
 Index: xc/programs/Xserver/hw/xfree86/input/wacom/wcmConfig.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmConfig.c     2005-12-24 
16:57:10.000000000 -0500
-@@ -0,0 +1,742 @@
++++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmConfig.c     2006-01-04 
22:14:58.000000000 -0500
+@@ -0,0 +1,773 @@
 +/*
-+ * Copyright 1995-2004 by Frederic Lepied, France. <[EMAIL PROTECTED]>
++ * Copyright 1995-2002 by Frederic Lepied, France. <[EMAIL PROTECTED]>
++ * Copyright 2002-2005 by Ping Cheng, Wacom. <[EMAIL PROTECTED]>
 + *                                                                            
 + * Permission to use, copy, modify, distribute, and sell this software and its
 + * documentation for any purpose is  hereby granted without fee, provided that
@@ -8249,7 +8264,7 @@
 +      priv->tvoffsetX = 0;                    /* none X edge offset for 
TwinView setup */
 +      priv->tvoffsetY = 0;                    /* none Y edge offset for 
TwinView setup */
 +      for (i=0; i<4; i++)
-+              priv->tvResolution[i] = 0;      /* unconfigured twinview 
resolution */
++              priv->tvResolution[i] = 0;      /* unconfigured twinview 
resolution */
 +
 +      /* JEJ - throttle sampling code */
 +      priv->throttleValue = 0;
@@ -8315,8 +8330,7 @@
 +
 +LocalDevicePtr xf86WcmAllocateEraser(void)
 +{
-+      LocalDevicePtr local = xf86WcmAllocate(XI_ERASER,
-+                      ABSOLUTE_FLAG|ERASER_ID);
++      LocalDevicePtr local = xf86WcmAllocate(XI_ERASER, 
ABSOLUTE_FLAG|ERASER_ID);
 +
 +      if (local)
 +              local->type_name = "Wacom Eraser";
@@ -8324,10 +8338,18 @@
 +      return local;
 +}
 +
-+/******************************************************************************
-+ * XFree86 V4 Module Configuration
-+ 
*****************************************************************************/
++/* xf86WcmAllocatePad */
 +
++LocalDevicePtr xf86WcmAllocatePad(void)
++{
++      LocalDevicePtr local = xf86WcmAllocate(XI_PAD, PAD_ID);
++
++      if (local)
++              local->type_name = "Wacom Pad";
++
++      return local;
++}
++
 +/* 
 + * Be sure to set vmin appropriately for your device's protocol. You want to
 + * read a full packet before returning
@@ -8440,6 +8462,8 @@
 +              local = xf86WcmAllocateCursor();
 +      else if (s && (xf86NameCmp(s, "eraser") == 0))
 +              local = xf86WcmAllocateEraser();
++      else if (s && (xf86NameCmp(s, "pad") == 0))
++              local = xf86WcmAllocatePad();
 +      else
 +      {
 +              xf86Msg(X_ERROR, "%s: No type or invalid type specified.\n"
@@ -8515,10 +8539,14 @@
 +               */
 +              if (IsCursor(priv)) 
 +                      priv->flags &= ~ABSOLUTE_FLAG;
-+              else
++              else 
 +                      priv->flags |= ABSOLUTE_FLAG;
 +      }
 +
++      /* pad always in relative mode since it doesn't move the cursor */
++      if (IsPad(priv)) 
++                      priv->flags &= ~ABSOLUTE_FLAG;
++
 +      xf86Msg(X_CONFIG, "%s is in %s mode\n", local->name,
 +              (priv->flags & ABSOLUTE_FLAG) ? "absolute" : "relative");
 +
@@ -8724,6 +8752,23 @@
 +                      xf86Msg(X_CONFIG, "%s: Tablet PC buttons on \n", 
common->wcmDevice);
 +      }
 +
++      /* Turn on/off Gimp support in a multimonitor setup */
++      if ( !common->wcmGimp )
++      {
++              common->wcmGimp = xf86SetBoolOption(local->options, "Gimp", 1);
++              if ( !common->wcmGimp )
++                      xf86Msg(X_CONFIG, "%s: Gimp multimonitor mapping isn't 
supported \n", common->wcmDevice);
++      }
++
++      /* Cursor stays in one monitor in a multimonitor setup */
++      if ( !common->wcmMMonitor )
++      {
++              common->wcmMMonitor = xf86SetBoolOption(local->options, 
"MMonitor", 1);
++              if ( !common->wcmMMonitor )
++                      xf86Msg(X_CONFIG, "%s: Cursor will stay in one monitor 
\n", common->wcmDevice);
++      }
++
++
 +      for (i=0; i<16; i++)
 +      {
 +              sprintf(b, "Button%d", i+1);
@@ -8774,43 +8819,43 @@
 +              xf86Msg(X_CONFIG, "%s: Accel = %d\n", dev->identifier,
 +                      priv->accel);
 +
-+      s = xf86FindOptionValue(local->options, "Twinview");
++      s = xf86FindOptionValue(local->options, "Twinview");
 +      if (s) xf86Msg(X_CONFIG, "%s: Twinview = %s\n", dev->identifier, s);
 +      if (s && xf86NameCmp(s, "none") == 0) 
-+      {
-+              priv->twinview = TV_NONE;
-+      }
++      {
++              priv->twinview = TV_NONE;
++      }
 +      else if (s && xf86NameCmp(s, "horizontal") == 0) 
-+      {
-+              priv->twinview = TV_LEFT_RIGHT;
++      {
++              priv->twinview = TV_LEFT_RIGHT;
 +              /* default resolution */
 +              if(!priv->tvResolution[0])
 +              {
 +                      priv->tvResolution[0] = screenInfo.screens[0]->width/2;
-+                      priv->tvResolution[1] = screenInfo.screens[0]->height;
-+                      priv->tvResolution[2] = priv->tvResolution[0];
++                      priv->tvResolution[1] = screenInfo.screens[0]->height;
++                      priv->tvResolution[2] = priv->tvResolution[0];
 +                      priv->tvResolution[3] = priv->tvResolution[1];
 +              }
-+      }
++      }
 +      else if (s && xf86NameCmp(s, "vertical") == 0) 
-+      {
-+              priv->twinview = TV_ABOVE_BELOW;
++      {
++              priv->twinview = TV_ABOVE_BELOW;
 +              /* default resolution */
 +              if(!priv->tvResolution[0])
 +              {
-+                      priv->tvResolution[0] = screenInfo.screens[0]->width;
-+                      priv->tvResolution[1] = screenInfo.screens[0]->height/2;
-+                      priv->tvResolution[2] = priv->tvResolution[0];
++                      priv->tvResolution[0] = screenInfo.screens[0]->width;
++                      priv->tvResolution[1] = screenInfo.screens[0]->height/2;
++                      priv->tvResolution[2] = priv->tvResolution[0];
 +                      priv->tvResolution[3] = priv->tvResolution[1];
 +              }
-+      }
++      }
 +      else if (s) 
-+      {
-+              xf86Msg(X_ERROR, "%s: invalid Twinview (should be none, 
vertical or horizontal). Using none.\n",
-+                      dev->identifier);
-+              priv->twinview = TV_NONE;
++      {
++              xf86Msg(X_ERROR, "%s: invalid Twinview (should be none, 
vertical or horizontal). Using none.\n",
++                      dev->identifier);
++              priv->twinview = TV_NONE;
 +      }
-+
++
 +      /* mark the device configured */
 +      local->flags |= XI86_POINTER_CAPABLE | XI86_CONFIGURED;
 +
@@ -8890,8 +8935,8 @@
 Index: xc/programs/Xserver/hw/xfree86/input/wacom/wcmFilter.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmFilter.c     2005-12-24 
16:57:10.000000000 -0500
-@@ -0,0 +1,414 @@
++++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmFilter.c     2006-01-04 
22:14:58.000000000 -0500
+@@ -0,0 +1,364 @@
 +/*
 + * Copyright 1995-2003 by Frederic Lepied, France. <[EMAIL PROTECTED]>
 + *                                                                            
@@ -8928,7 +8973,7 @@
 +              double a, double b);
 +static void filterLine(int* pCurve, int nMax, int x0, int y0, int x1, int y1);
 +static void filterIntuosStylus(WacomFilterStatePtr state, WacomDeviceStatePtr 
ds);
-+static void filterIntuosCoord(int* coord, int* current, int tilt, int* state);
++static void filterIntuosCoord(int* state, int* current);
 +static void filterIntuosTilt(int* state, int* tilt);
 +
 +/*****************************************************************************
@@ -9121,76 +9166,26 @@
 +      }
 +
 +      /* filter x */
-+      filterIntuosCoord(state->x, &ds->x, ds->tiltx, &state->statex);
++      filterIntuosCoord(state->x, &ds->x);
 +      /* filter y */
-+      filterIntuosCoord(state->y, &ds->y, ds->tilty, &state->statey);
++      filterIntuosCoord(state->y, &ds->y);
 +      /* filter tiltx */
 +      filterIntuosTilt(state->tiltx, &ds->tiltx);
 +      /* filter tilty */
 +      filterIntuosTilt(state->tilty, &ds->tilty);
 +}
 +
-+static void filterIntuosCoord(int* coord, int* current, int tilt, int* state)
++static void filterIntuosCoord(int* state, int* current)
 +{
-+      int ts;
-+      int x0_pred;
-+      int x0_pred1;
-+      int x0, x1, x2, x3;
++      int x;
 +
-+      x0 = *current;
-+      x1 = coord[0];
-+      x2 = coord[1];
-+      x3 = coord[2];
-+      coord[0] = x0;
-+      coord[1] = x1;
-+      coord[2] = x2;
-+    
-+      ts = tilt >= 0 ? 1 : -1;
-+    
-+      if (*state == 0 || *state == 3)
-+      {
-+              if (ts * (x0 - 2 * x1 - x2) > 12 && 
-+                      ts * (x0 - 3 * x2 - 2 * x3) > 12)
-+              {
-+                      /* detected a jump at x0 */
-+                      *state = 1;
-+                      *current = x1;
-+              }
-+              else if (*state == 0)
-+              {
-+                      x0_pred = 7 * x0 + 14 * x1 + 15 * x2 + 16;
-+                      x0_pred1 = 4 * x3;
-+                      if (x0_pred > x0_pred1)
-+                              *current = ((CARD32)(x0_pred - x0_pred1)) >> 5;
-+                      else
-+                              *current = 0;
-+              }
-+              else
-+              {
-+                      /* state == 3 
-+                       * a jump at x3 was detected */
-+                      *current = (x0 + 2 * x1 + x2 + 2) >> 2;
-+                      *state = 0;
-+              }
-+      }
-+      else if (*state == 1)
-+      {
-+              /* a jump at x1 was detected */
-+              x0_pred = 3 * x0 + 7 * x2 + 4;
-+              x0_pred1 = 2 * x3;
-+              if (x0_pred > x0_pred1)
-+                      *current = ((CARD32)(x0_pred - x0_pred1)) >> 3;
-+              else
-+                      *current = 0;
-+              *state = 2;
-+      }
-+      else
-+      {
-+              /* state == 2 
-+               * a jump at x2 was detected */
-+              *current = x1;
-+              *state = 3;
-+      }
++      x = *current + state[0] + state[1] + state[2];
++
++      state[2] = state[1];
++      state[1] = state[0];
++      state[0] = *current;
++
++      *current = x / MAX_SAMPLES;
 +}
 +
 +/*****************************************************************************
@@ -9309,7 +9304,7 @@
 Index: xc/programs/Xserver/hw/xfree86/input/wacom/wcmFilter.h
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmFilter.h     2005-12-24 
16:57:10.000000000 -0500
++++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmFilter.h     2006-01-04 
22:15:07.000000000 -0500
 @@ -0,0 +1,41 @@
 +/*
 + * Copyright 1995-2003 by Frederic Lepied, France. <[EMAIL PROTECTED]>
@@ -9355,7 +9350,7 @@
 Index: xc/programs/Xserver/hw/xfree86/input/wacom/wcmISDV4.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmISDV4.c      2005-12-24 
16:57:10.000000000 -0500
++++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmISDV4.c      2006-01-04 
22:14:58.000000000 -0500
 @@ -0,0 +1,288 @@
 +/*
 + * Copyright 1995-2003 by Frederic Lepied, France. <[EMAIL PROTECTED]>
@@ -9409,7 +9404,7 @@
 +              NULL,                 /* tilt automatically enabled */
 +              NULL,                 /* suppress implemented in software */
 +              NULL,                 /* link speed unsupported */
-+              isdv4StartTablet,     /* start not supported */
++              isdv4StartTablet,     /* start tablet */
 +              isdv4Parse,
 +              xf86WcmHysteresisFilter,   /* input filtering */
 +      };
@@ -9648,10 +9643,10 @@
 Index: xc/programs/Xserver/hw/xfree86/input/wacom/wcmSerial.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmSerial.c     2005-12-24 
16:57:10.000000000 -0500
++++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmSerial.c     2006-01-04 
22:14:58.000000000 -0500
 @@ -0,0 +1,1321 @@
 +/*
-+ * Copyright 1995-2004 by Frederic Lepied, France. <[EMAIL PROTECTED]>
++ * Copyright 1995-2005 by Frederic Lepied, France. <[EMAIL PROTECTED]>
 + *                                                                            
 + * Permission to use, copy, modify, distribute, and sell this software and its
 + * documentation for any purpose is  hereby granted without fee, provided that
@@ -10357,7 +10352,7 @@
 +      const unsigned char* data)
 +{
 +      int n;
-+      int is_stylus=0, have_data=0;
++      int have_data=0;
 +      int channel;
 +      WacomDeviceState* ds;
 +
@@ -10418,7 +10413,6 @@
 +      else if (((data[0] & 0xb8) == 0xa0) ||
 +                      ((data[0] & 0xbe) == 0xb4))
 +      {
-+              is_stylus = 1;
 +              ds->x = (((data[1] & 0x7f) << 9) |
 +                              ((data[2] & 0x7f) << 2) |
 +                              ((data[3] & 0x60) >> 5));
@@ -10429,7 +10423,7 @@
 +              {
 +                      ds->pressure = (((data[5] & 0x07) << 7) |
 +                              (data[6] & 0x7f));
-+                      ds->buttons = (((data[0]) & 0x06));
++                      ds->buttons = (data[0] & 0x06);
 +              }
 +              else
 +              {
@@ -10451,7 +10445,6 @@
 +      else if (((data[0] & 0xbe) == 0xa8) ||
 +                      ((data[0] & 0xbe) == 0xb0))
 +      {
-+              is_stylus = 0;
 +              ds->x = (((data[1] & 0x7f) << 9) |
 +                              ((data[2] & 0x7f) << 2) |
 +                              ((data[3] & 0x60) >> 5));
@@ -10494,7 +10487,6 @@
 +      /* 4D mouse 2nd packet */
 +      else if ((data[0] & 0xbe) == 0xaa)
 +      {
-+              is_stylus = 0;
 +              ds->x = (((data[1] & 0x7f) << 9) |
 +                      ((data[2] & 0x7f) << 2) |
 +                      ((data[3] & 0x60) >> 5));
@@ -10639,7 +10631,7 @@
 +      common->wcmPktLength = 7;
 +      common->wcmVersion = version;
 +
-+      common->wcmMaxZ = 256;
++      common->wcmMaxZ = 255;
 +      common->wcmResolX = 1000; /* tablet X resolution in points/inch */
 +      common->wcmResolY = 1000; /* tablet Y resolution in points/inch */
 +}
@@ -10656,9 +10648,9 @@
 +      /* Graphire models don't answer WC_COORD requests */
 +      common->wcmMaxX = 5103;
 +      common->wcmMaxY = 3711;
-+      common->wcmMaxZ = 512;
-+      common->wcmResolX = 1000; /* tablet X resolution in points/inch */
-+      common->wcmResolY = 1000; /* tablet Y resolution in points/inch */
++      common->wcmMaxZ = 511;
++      common->wcmResolX = 1016; /* tablet X resolution in points/inch */
++      common->wcmResolY = 1016; /* tablet Y resolution in points/inch */
 +}
 +
 +static void serialInitProtocol4(WacomCommonPtr common, int fd,
@@ -10910,10 +10902,6 @@
 +      if (!last->proximity && ds->proximity) 
 +              ds->device_type = cur_type;
 +
-+      /* out of prox */
-+      else if (!ds->proximity)
-+              memset(ds,0,sizeof(*ds));
-+
 +      /* check on previous proximity */
 +      else if (is_stylus)
 +      {
@@ -10928,6 +10916,13 @@
 +                      ds->device_type = cur_type;
 +              }
 +      }
++      else if (ds->device_type != cur_type) /* missed out-prox event*/
++      {
++              /* send a prox-out for old device */
++              WacomDeviceState out = { 0 };
++              xf86WcmEvent(common,0,&out);
++              ds->device_type = cur_type;
++      }
 +
 +      DBG(8, ErrorF("serialParseP4Common %s\n",
 +              ds->device_type == CURSOR_ID ? "CURSOR" :
@@ -10974,7 +10969,7 @@
 Index: xc/programs/Xserver/hw/xfree86/input/wacom/wcmSerial.h
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmSerial.h     2005-12-24 
16:57:10.000000000 -0500
++++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmSerial.h     2006-01-04 
22:15:07.000000000 -0500
 @@ -0,0 +1,70 @@
 +/*
 + * Copyright 1995-2003 by Frederic Lepied, France. <[EMAIL PROTECTED]>
@@ -11049,10 +11044,10 @@
 Index: xc/programs/Xserver/hw/xfree86/input/wacom/wcmUSB.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmUSB.c        2005-12-24 
16:57:10.000000000 -0500
-@@ -0,0 +1,603 @@
++++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmUSB.c        2006-01-04 
22:14:58.000000000 -0500
+@@ -0,0 +1,718 @@
 +/*
-+ * Copyright 1995-2003 by Frederic Lepied, France. <[EMAIL PROTECTED]>
++ * Copyright 1995-2004 by Frederic Lepied, France. <[EMAIL PROTECTED]>
 + *                                                                            
 + * Permission to use, copy, modify, distribute, and sell this software and its
 + * documentation for any purpose is  hereby granted without fee, provided that
@@ -11233,6 +11228,21 @@
 +              xf86WcmFilterIntuos,  /* input filtering recommended */
 +      };
 +
++      static WacomModel usbIntuos3 =
++      {
++              "USB Intuos3",
++              usbInitProtocol5,
++              NULL,                 /* resolution not queried */
++              usbGetRanges,
++              NULL,                 /* reset not supported */
++              NULL,                 /* tilt automatically enabled */
++              NULL,                 /* suppress implemented in software */
++              NULL,                 /* link speed unsupported */
++              NULL,                 /* start not supported */
++              usbParse,
++              xf86WcmFilterIntuos,  /* input filtering recommended */
++      };
++
 +      static WacomModel usbVolito =
 +      {
 +              "USB Volito",
@@ -11248,6 +11258,20 @@
 +              xf86WcmFilterCoord,   /* input filtering */
 +      };
 +
++      static WacomModel usbCintiqV5 =
++      {
++              "USB Cintiq 21UX",
++              usbInitProtocol5,
++              NULL,                 /* resolution not queried */
++              usbGetRanges,
++              NULL,                 /* reset not supported */
++              NULL,                 /* tilt automatically enabled */
++              NULL,                 /* suppress implemented in software */
++              NULL,                 /* link speed unsupported */
++              NULL,                 /* start not supported */
++              usbParse,
++              xf86WcmFilterIntuos,  /* input filtering recommended */
++      };
 +
 +/*****************************************************************************
 + * usbDetect --
@@ -11265,12 +11289,23 @@
 +    
 +      if (!err)
 +      {
-+              ErrorF("%s Wacom Kernel Input driver version is %d.%d.%d\n",
++/*            ErrorF("%s Wacom Kernel Input driver version is %d.%d.%d\n",
 +                              XCONFIG_PROBED, version >> 16,
 +                              (version >> 8) & 0xff, version & 0xff);
-+              return 1;
++*/            return 1;
 +      }
 +
++      /* for kernel 2.6 or later */
++#ifdef EV_SYN
++      /* Try to grab the event device so that data don't leak to 
/dev/input/mice */
++      SYSCALL(err = ioctl(local->fd, EVIOCGRAB, (pointer)1));
++
++      if (err < 0) {
++              ErrorF("%s Wacom X driver can't grab event device, errno=%d\n",
++                      local->name, errno);
++      }
++#endif
++
 +      return 0;
 +}
 +
@@ -11340,6 +11375,14 @@
 +
 +                      case 0x60: /* Volito */
 +                              model = &usbVolito; break;
++
++                      case 0xB0: /* Intuos3 4x5 */
++                      case 0xB1: /* Intuos3 6x8 */
++                      case 0xB2: /* Intuos3 9x12 */
++                              model = &usbIntuos3; break;
++
++                      case 0x3F: /* Cintiq 21UX */
++                              model = &usbCintiqV5; break;
 +              }
 +      }
 +
@@ -11353,9 +11396,17 @@
 +      float version)
 +{
 +      DBG(2, ErrorF("detected a protocol 5 model (%s)\n",id));
-+      common->wcmResolX = common->wcmResolY = 2540;
 +      common->wcmProtocolLevel = 5;
-+      common->wcmChannelCnt = 2;
++      if ( strstr(id, "Intuos3") || strstr(id, "21UX") )
++      {
++              common->wcmChannelCnt = 1;
++              common->wcmResolX = common->wcmResolY = 5080;
++      }
++      else
++      {
++              common->wcmChannelCnt = 2;
++              common->wcmResolX = common->wcmResolY = 2540;
++      }
 +      common->wcmPktLength = sizeof(struct input_event);
 +}
 +
@@ -11363,7 +11414,12 @@
 +      float version)
 +{
 +      DBG(2, ErrorF("detected a protocol 4 model (%s)\n",id));
-+      common->wcmResolX = common->wcmResolY = 1016;
++      if ( strstr(id, "Cintiq") )
++              common->wcmResolX = common->wcmResolY = 508;
++      else if ( strstr(id, "PenPartner") )
++              common->wcmResolX = common->wcmResolY = 1000;
++      else
++              common->wcmResolX = common->wcmResolY = 1016;
 +      common->wcmProtocolLevel = 4;
 +      common->wcmPktLength = sizeof(struct input_event);
 +}
@@ -11405,6 +11461,11 @@
 +                              return !Success;
 +                      }
 +                      common->wcmMaxX = nValues[2];
++                      if (common->wcmMaxX <= 0)
++                      {
++                              ErrorF("WACOM: xmax value is wrong.\n");
++                              return !Success;
++                      }
 +              }
 +
 +              /* max y */
@@ -11416,6 +11477,11 @@
 +                              return !Success;
 +                      }
 +                      common->wcmMaxY = nValues[2];
++                      if (common->wcmMaxY <= 0)
++                      {
++                              ErrorF("WACOM: ymax value is wrong.\n");
++                              return !Success;
++                      }
 +              }
 +
 +              /* max z cannot be configured */
@@ -11425,7 +11491,17 @@
 +                      return !Success;
 +              }
 +              common->wcmMaxZ = nValues[2];
++              if (common->wcmMaxZ <= 0)
++              {
++                      ErrorF("WACOM: press max value is wrong.\n");
++                      return !Success;
++              }
 +      }
++      else
++      {
++              ErrorF("WACOM: unable to ioctl max values.\n");
++              return !Success;
++      }
 +
 +      return Success;
 +}
@@ -11458,12 +11534,13 @@
 +      /* save it for later */
 +      common->wcmEvents[common->wcmEventCnt++] = *event;
 +
-+      /* packet terminated by MSC_SERIAL on kernel 2.4 and SYN_REPORT on 
kernel 2.5 */
++      /* packet terminated by MSC_SERIAL on kernel 2.4 and SYN_REPORT on 
kernel 2.6 */
 +      if ((event->type != EV_MSC) || (event->code != MSC_SERIAL))
 +      {
 +#ifdef EV_SYN
 +              /* none serial number tools fall here */
-+              if ((event->type == EV_SYN) && (event->code == SYN_REPORT) && 
(common->wcmChannelCnt == 1))
++              if ((event->type == EV_SYN) && (event->code == SYN_REPORT) 
++                      && (common->wcmChannelCnt == 1))
 +              {
 +                      usbParseChannel(common,0,0);
 +                      common->wcmEventCnt = 0;
@@ -11475,9 +11552,26 @@
 +      serial = event->value;
 +      channel = -1;
 +
-+      /* one channel only? must be it. */
++      /* one channel only? */
 +      if (common->wcmChannelCnt == 1)
-+              channel = 0;
++      {
++              /* Intuos3 Pad */
++              if (serial == 0xffffffff)
++              {
++                      channel = 1;
++                      (&common->wcmChannel[channel].work)->device_type = 
PAD_ID;
++                      (&common->wcmChannel[channel].work)->proximity = 1;
++              }
++              else   /* must be it. */
++              {
++                      channel = 0;
++                      if (common->wcmChannel[0].work.proximity == 0)
++                      {
++                              memset(&common->wcmChannel[0],0,
++                                              sizeof(WacomChannel));
++                      }
++              }
++      }
 +
 +      /* otherwise, find the channel */
 +      else
@@ -11509,6 +11603,8 @@
 +                              if (common->wcmChannel[i].work.proximity == 0)
 +                              {
 +                                      channel = i;
++                                      /* the in-prox event was missing */
++                                      common->wcmChannel[i].work.proximity = 
1;
 +                                      break;
 +                              }
 +                      }
@@ -11531,13 +11627,14 @@
 +
 +static void usbParseChannel(WacomCommonPtr common, int channel, int serial)
 +{
-+      int i;
++      int i, shift;
 +      WacomDeviceState* ds;
 +      struct input_event* event;
 +
 +      #define MOD_BUTTONS(bit, value) do { \
++              shift = 1<<bit; \
 +              ds->buttons = (((value) != 0) ? \
-+              (ds->buttons | (bit)) : (ds->buttons & ~(bit))); \
++              (ds->buttons | (shift)) : (ds->buttons & ~(shift))); \
 +              } while (0)
 +
 +      /* all USB data operates from previous context except relative values*/
@@ -11549,7 +11646,6 @@
 +      for (i=0; i<common->wcmEventCnt; ++i)
 +      {
 +              event = common->wcmEvents + i;
-+
 +              DBG(11, ErrorF("usbParseChannel event[%d]->type=%d "
 +                      "code=%d value=%d\n", i, event->type,
 +                      event->code, event->value));
@@ -11561,6 +11657,10 @@
 +                              ds->x = event->value;
 +                      else if (event->code == ABS_Y)
 +                              ds->y = event->value;
++                      else if (event->code == ABS_RX)
++                              ds->stripx = event->value; 
++                      else if (event->code == ABS_RY)
++                              ds->stripy = event->value;
 +                      else if (event->code == ABS_RZ)
 +                              ds->rotation = event->value;
 +                      else if (event->code == ABS_TILT_X)
@@ -11568,9 +11668,7 @@
 +                      else if (event->code ==  ABS_TILT_Y)
 +                              ds->tilty = event->value - 64;
 +                      else if (event->code == ABS_PRESSURE)
-+                      {
 +                              ds->pressure = event->value;
-+                      }
 +                      else if (event->code == ABS_DISTANCE)
 +                              ds->distance = event->value;
 +                      else if (event->code == ABS_WHEEL)
@@ -11583,10 +11681,7 @@
 +                      if (event->code == REL_WHEEL)
 +                              ds->relwheel = event->value;
 +                      else
-+                      {
-+                              ErrorF("wacom: rel event recv'd (%d)!\n",
-+                                      event->code);
-+                      }
++                              ErrorF("wacom: rel event recv'd (%d)!\n", 
event->code);
 +              }
 +
 +              else if (event->type == EV_KEY)
@@ -11618,6 +11713,13 @@
 +                              ds->device_type = CURSOR_ID;
 +                              ds->proximity = (event->value != 0);
 +                      }
++                      else if (event->code == BTN_TOOL_FINGER)
++                      {
++                              DBG(6, ErrorF("USB Intuos3 Pad detected %x\n",
++                                      event->code));
++                              ds->device_type = PAD_ID;
++                              ds->proximity = (event->value != 0);
++                      }
 +                      else if (event->code == BTN_TOUCH)
 +                      {
 +                              /* we use the pressure to determine the button 
1 */
@@ -11625,30 +11727,38 @@
 +                      else if ((event->code == BTN_STYLUS) ||
 +                              (event->code == BTN_MIDDLE))
 +                      {
-+                              MOD_BUTTONS (2, event->value);
++                              MOD_BUTTONS (1, event->value);
 +                      }
 +                      else if ((event->code == BTN_STYLUS2) ||
 +                              (event->code == BTN_RIGHT))
 +                      {
-+                              MOD_BUTTONS (4, event->value);
++                              MOD_BUTTONS (2, event->value);
 +                      }
 +                      else if (event->code == BTN_LEFT)
-+                              MOD_BUTTONS (1, event->value);
++                              MOD_BUTTONS (0, event->value);
 +                      else if (event->code == BTN_SIDE)
++                              MOD_BUTTONS (3, event->value);
++                      else if (event->code == BTN_EXTRA)
++                              MOD_BUTTONS (4, event->value);
++                      else if (event->code == BTN_0)
 +                              MOD_BUTTONS (8, event->value);
-+                      else if (event->code == BTN_EXTRA)
-+                              MOD_BUTTONS (16, event->value);
++                      else if (event->code == BTN_1)
++                              MOD_BUTTONS (9, event->value);
++                      else if (event->code == BTN_2)
++                              MOD_BUTTONS (10, event->value);
++                      else if (event->code == BTN_3)
++                              MOD_BUTTONS (11, event->value);
++                      else if (event->code == BTN_4)
++                              MOD_BUTTONS (12, event->value);
++                      else if (event->code == BTN_5)
++                              MOD_BUTTONS (13, event->value);
++                      else if (event->code == BTN_6)
++                              MOD_BUTTONS (14, event->value);
++                      else if (event->code == BTN_7)
++                              MOD_BUTTONS (15, event->value);
 +              }
-+      } /* next event */
++      } /* next event */      
 +
-+      if ( !ds->device_type ){
-+              DBG(6, ErrorF("USB tool type missing \n"));
-+
-+              /* defaults to puck and in prox */
-+              ds->device_type = CURSOR_ID;
-+              ds->proximity = 1;
-+      }
-+
 +      /* dispatch event */
 +      xf86WcmEvent(common, channel, ds);
 +}
@@ -11656,8 +11766,8 @@
 +#endif /* LINUX_INPUT */
 Index: xc/programs/Xserver/hw/xfree86/input/wacom/Imakefile
 ===================================================================
---- xc/programs/Xserver/hw/xfree86/input/wacom/Imakefile.orig  2005-12-24 
16:43:08.000000000 -0500
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/Imakefile       2005-12-24 
16:57:10.000000000 -0500
+--- xc/programs/Xserver/hw/xfree86/input/wacom/Imakefile.orig  2006-01-04 
21:45:35.000000000 -0500
++++ xc/programs/Xserver/hw/xfree86/input/wacom/Imakefile       2006-01-04 
22:08:46.000000000 -0500
 @@ -7,8 +7,8 @@
  DEFINES = -DLINUX_INPUT
  #endif


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to