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

Bug#172526: [wacom] Patch for Cintiq support



Package: xserver-xfree86
Version: 4.2.1-4
Severity: wishlist
File: /usr/X11R6/lib/modules/input/wacom_drv.o
Tags: upstream patch

The following patch will improve the support for Wacom Cintiq boards.
While it's still not perfect[1], it at least makes Cintiqs useable under
X[2]. I already sent this patch to upstream's Frederic Lepied, but got no
response at all. But nevertheless it would be great if this patch would
make it into Debian and maybe also into upstream XFree.

---------------------------------------------------------------------

--- xf86Wacom.c.xfree	2001-12-26 22:51:59.000000000 +0100
+++ xf86Wacom.c	2002-12-10 15:24:06.000000000 +0100
@@ -165,6 +165,7 @@
  *****************************************************************************/
 #define TILT_FLAG	1
 #define GRAPHIRE_FLAG	2
+#define CINTIQ_FLAG	4
 
 typedef struct
 {
@@ -644,10 +645,16 @@
 		   int			rwheel)
 		   
 {
-    int             button;
+    int             button, maxbutton;
     WacomDevicePtr  priv = (WacomDevicePtr) local->private;
+    WacomCommonPtr  common = priv->common;
 
-    for (button=1; button<=16; button++) {
+    if (common->wcmFlags & CINTIQ_FLAG)
+	maxbutton = 3;
+    else
+	maxbutton = 16;
+
+    for (button=1; button<=maxbutton; button++) {
 	int mask = 1 << (button-1);
 	
 	if ((mask & priv->oldButtons) != (mask & buttons)) {
@@ -810,7 +817,8 @@
 	}
 
 	if (common->wcmProtocolLevel == 4 &&
-	    !(common->wcmFlags & GRAPHIRE_FLAG)) {
+	    !(common->wcmFlags & GRAPHIRE_FLAG) &&
+	    !(common->wcmFlags & CINTIQ_FLAG)) {
 	    /* The stylus reports button 4 for the second side
 	     * switch and button 4/5 for the eraser tip. We know
 	     * how to choose when we come in proximity for the
@@ -837,15 +845,17 @@
 		}
 	    }
 	}
+
 	DBG(4, ErrorF("xf86WcmSendEvents %s rx=%d ry=%d rz=%d buttons=%d\n",
 		      is_stylus ? "stylus" : "cursor", rx, ry, rz, buttons));
-	
+
 	/* Turn button index reported into a bit mask for WACOM IV.
 	 * The WACOM V and Graphire models already report buttons
 	 * as a bit mask.
 	 */
 	if (common->wcmProtocolLevel == 4 &&
-	    !(common->wcmFlags & GRAPHIRE_FLAG)) {
+	    !(common->wcmFlags & GRAPHIRE_FLAG) &&
+	    !(common->wcmFlags & CINTIQ_FLAG)) {
 	    buttons = 1 << (buttons - 1);
 	}
 	
@@ -2009,8 +2019,11 @@
 		       XCONFIG_PROBED, common->wcmThreshold);
 	    }
 	}
+    } else if (buffer[2] == 'P' && buffer[3] == 'L') {
+	DBG(2, ErrorF("detected an Cintiq model\n"));
+	common->wcmFlags |= CINTIQ_FLAG;
     }
-	
+
     /* Tilt works on ROM 1.4 and above */
     DBG(2, ErrorF("wacom flags=%d ROM version=%f buffer=%s\n",
 		  common->wcmFlags, version, buffer+loop+1));

---------------------------------------------------------------------

This is what this patch does:

 * Recognizes the Cintiq tablet and sets a flag in the driver's private
   data section.
 * When a drag is performed (e.g. because a window is moved on the
   screen), the board will send a continuous stream of button 1 events
   (okay), interspersed with button 4 events. These latter events cause
   X to interrupt the dragging movement, making it impossible. The patch
   causes the driver not to send button 4 events for Cintiq tablets.
   While this is not the ideal solution, it works.
 * Disable a work-around for some boards (button 4/eraser related) for
   the Cintiq.
 * The button index is reported correctly for Cintiq boards. Disable
   workaround for them.

 - Sebastian

[1] Two problems: Since it seems that the Cintiq doesn't send a CR at
    the end of its ID string, the driver will wait for it until it times
    out. This delays the startup of the X server a little. The other
    problem is the button 4 event that gets swallowed with this patch.
    Although it interferes with button 1 event it certainly has a
    meaning. This part could be improved.
[2] These are really great boards. The combination of an LCD screen at a
    graphic tablet is perfect. This is how it's supposed to be.





Reply to: