TC1100 stylus buttons patch

From LQWiki
Jump to navigation Jump to search

Summary

This patch for the X server Wacom drivers maps the TC1100 stylus-activated buttons to mouse buttons 30, 31 and 32.

Patch listing

diff -rN -c linuxwacom-0.7.8-3/src/xdrv/wcmISDV4.c linuxwacom-0.7.8-3-patched/src/xdrv/wcmISDV4.c
*** linuxwacom-0.7.8-3/src/xdrv/wcmISDV4.c	2007-08-15 01:12:39.000000000 +0200
--- linuxwacom-0.7.8-3-patched/src/xdrv/wcmISDV4.c	2008-01-09 02:54:11.000000000 +0100
***************
*** 231,236 ****
--- 231,263 ----
  		return n;
  	else
  	{
+ 	
+ 	   /* handle TC1100 stylus buttons */
+ 		if ((data[0] == 0xC1) && ((data[1] & 0xF0) == 0))
+ 		{
+ 		   DBG(2, priv->debugLevel, ErrorF("isdv4Parse Tablet Button %s\n",
+ 		      data[1] == 0x1 ? "rotate" : data[1] == 0x2 ? "journal"
+ 	         : data[1] == 0x4 ? "keyboard" : "unknown" ));
+ 	      
+ 	      /* do not reset relative values here */
+ 	      ds = &common->wcmChannel[0].work;
+ 	      
+ 	      /* first send the tablet button press event */
+ 	      ds->proximity = 1;
+ 	      ds->buttons = ((int)data[1]) << 29;
+ 	      ds->pressure = common->wcmMaxZ;
+ 	      ds->device_id = STYLUS_DEVICE_ID;
+ 	      ds->device_type = STYLUS_ID;
+ 	      xf86WcmEvent(common, 0, ds);
+ 	      
+ 	      /* then immediately after send the release event */
+ 	      ds->buttons = 0;
+ 	      ds->pressure = 0;
+ 	      ds->proximity = 0;
+ 			xf86WcmEvent(common, 0, ds);
+ 	      return common->wcmPktLength;
+ 		}
+ 	
  		/* Coordinate data bit check */
  		if (data[0] & 0x40)
  			return common->wcmPktLength;