[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haiku-commits
Subject:    [haiku-commits] haiku: hrev50553 - src/add-ons/input_server/devices/wacom
From:       pulkomandy () pulkomandy ! tk
Date:       2016-09-26 18:36:46
Message-ID: 20160926183646.B15235C2313 () vmrepo ! haiku-os ! org
[Download RAW message or body]

hrev50553 adds 1 changeset to branch 'master'
old head: 08e5249142cc88561e8219e41deeefd3ef5acc80
new head: 999c255ac5bad2d19b37a9aa1750c32904148e11
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=999c255ac5ba+%5E08e5249142cc

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

999c255ac5ba: fix for older Wacom tablet
  
  Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
  
  This spent enough years waiting on the bugtracker for someone willing to
  test it. The style looks mostly ok, so let's have it in trunk and see if
  it breaks someone's tablet.
  
  The patch restores the older behavior found in early versions of the
  driver published for BeOS. It does so only for the "intuos" tablets, so
  newer devices won't be affected.
  
  ticket : #4847

                                [ Pete Goodeve <pete.goodeve@computer.org> ]

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

Revision:    hrev50553
Commit:      999c255ac5bad2d19b37a9aa1750c32904148e11
URL:         http://cgit.haiku-os.org/haiku/commit/?id=999c255ac5ba
Author:      Pete Goodeve <pete.goodeve@computer.org>
Date:        Sun Sep 28 00:17:05 2014 UTC
Committer:   Adrien Destugues <pulkomandy@pulkomandy.tk>
Commit-Date: Mon Sep 26 18:33:59 2016 UTC

Ticket:      https://dev.haiku-os.org/ticket/4847

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

1 file changed, 21 insertions(+), 7 deletions(-)
.../input_server/devices/wacom/TabletDevice.cpp  | 28 +++++++++++++++-----

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

diff --git a/src/add-ons/input_server/devices/wacom/TabletDevice.cpp \
b/src/add-ons/input_server/devices/wacom/TabletDevice.cpp index b187573..345b819 \
                100644
--- a/src/add-ons/input_server/devices/wacom/TabletDevice.cpp
+++ b/src/add-ons/input_server/devices/wacom/TabletDevice.cpp
@@ -386,18 +386,32 @@ TabletDevice::ReadData(const uchar* data, int dataBytes, bool& \
hasContact,  pressure = 0.0;
 					eraser = 0;
 				} else {
-//					eraser = (data[1] & 0x20); // eraser is een tool-id
-//					firstButton = (pressureData > 0) && data[9] <= 0x68;// > 180);
-//					firstButton = (pressureData > 180);
-					firstButton = (data[6] > 0);
+					firstButton = (data[6] > 2);
+						// For Intuos it MUST be >1,
+						// but '>1' still gets false actuations (shaking)
 					secondButton = (data[1] & 0x02);
 					thirdButton = (data[1] & 0x04);
 					hasContact = (data[1] & 0x40);
-					// convert tilt (-128 ... 127)
-//					int8 tiltDataX = ((data[7] & 0x3f) << 2) | ((data[8] & 0x80) >> 6);
+						// TODO: is this meaningful? (always true on Intuos)
+					if (fDeviceMode == DEVICE_INTUOS) {	// TODO: test perhaps superfluous?
+						// Original Intuos protocol:
+						//  data[6] is used to signal use of the eraser,
+						//  as well as being the high bits of pressure.
+						//  While not in contact:
+						//	 If the pen end is lowermost data[6] = 1;
+						//	 If the eraser end is down data[6] = 0, and pressure is strictly 0
+						//   data[9] (top 5 bits: 0x70..0xd0) indicates height above the tablet.
+						eraser = fEraser;
+							// keep established value unless not touching pad
+						// Eraser state only valid when away from surface
+						if (data[6] <= 1 && data[9] > 0x80) { 	// not touching tablet
+							if (pressureData == 0) eraser = 1;	// strictly 0 means eraser
+							else if (pressureData > 6) eraser = 0;	// avoid slop
+						}
+					}
+					// Get raw tilt values (0..54..127)
 					int8 tiltDataX = ((data[7] & 0x3f) << 1) | ((data[8] & 0x80) >> 7);
 					int8 tiltDataY = data[8] & 0x7f;
-//					int8 tiltDataY = 0;
 					// convert to floats
 					tiltX = (float)(tiltDataX - 64) / 64.0;
 					tiltY = (float)(tiltDataY - 64) / 64.0;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic