Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12:Update
xf86-input-wacom
U_05-Remove-duplicate-tool-type-detection.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File U_05-Remove-duplicate-tool-type-detection.patch of Package xf86-input-wacom
From: Egbert Eich <eich@suse.com> Date: Wed Apr 9 21:27:04 2014 +0200 Subject: [PATCH 5/6]Remove duplicate tool type detection Patch-Mainline: Upstream Git-commit: 261ca70cfdc17c1e927b80190d127226798172c0 Git-repo: git://linuxwacom.git.sourceforge.net/gitroot/linuxwacom/xf86-input-wacom References: FATE# Signed-off-by: Egbert Eich <eich@suse.com> Tool type detection is done in two places: early in usbDispatchEvents() by calling usbInitToolType() and later on in the same function when the events are parsed. usbInitToolType() is used to set (wcmUSBData*)->wcmDeviceType, the detection that happens later when the events are parsed sets (WacomDeviceState).device_type. These variables are matched against each to find the right channel for a device. If the algorithms used for both set of tool type detection diverge undesirable effects may happen. Therefore it is advisable to determine the tool type only once ie. in usbInitToolType() and copy the result to (WacomDeviceState).device_type if this value is unset. * Bring the algorithm in usbInitToolType() in sync with the reset: Add missing key codes to deviceTypeFromEvent() - Add BTN_TOOL_DOUBLETAP and BTN_TOOL_TRIPLETAP, return TOUCH_ID for them. - Return TOUCH_ID on BTN_TOUCH when protocol level is WCM_PROTOCOL_GENERIC and tool is a 1 finger USB touch. * Delete any duplicate tool type setting * Add a test for debugging if the device type has changed while in proximity. Signed-off-by: Egbert Eich <eich@suse.com> Reviewed-by: Jason Gerecke <killertofu@gmail.com> --- src/wcmUSB.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/wcmUSB.c b/src/wcmUSB.c index c060ec5..6932b9f 100644 --- a/src/wcmUSB.c +++ b/src/wcmUSB.c @@ -1272,6 +1272,7 @@ static void usbParseAbsMTEvent(WacomCommonPtr common, struct input_event *event) case ABS_MT_TRACKING_ID: ds->proximity = (event->value != -1); + /* set this here as type for this channel doesn't get set in usbDispatchEvent() */ ds->device_type = TOUCH_ID; ds->device_id = TOUCH_DEVICE_ID; ds->sample = (int)GetTimeInMillis(); @@ -1315,7 +1316,6 @@ static void usbParseKeyEvent(WacomCommonPtr common, case BTN_TOOL_PENCIL: case BTN_TOOL_BRUSH: case BTN_TOOL_AIRBRUSH: - ds->device_type = STYLUS_ID; /* V5 tools use ABS_MISC to report device_id */ if (common->wcmProtocolLevel == WCM_PROTOCOL_4) ds->device_id = STYLUS_DEVICE_ID; @@ -1326,7 +1326,6 @@ static void usbParseKeyEvent(WacomCommonPtr common, break; case BTN_TOOL_RUBBER: - ds->device_type = ERASER_ID; /* V5 tools use ABS_MISC to report device_id */ if (common->wcmProtocolLevel == WCM_PROTOCOL_4) ds->device_id = ERASER_DEVICE_ID; @@ -1343,7 +1342,6 @@ static void usbParseKeyEvent(WacomCommonPtr common, DBG(6, common, "USB mouse detected %x (value=%d)\n", event->code, event->value); - ds->device_type = CURSOR_ID; /* V5 tools use ABS_MISC to report device_id */ if (common->wcmProtocolLevel == WCM_PROTOCOL_4) ds->device_id = CURSOR_DEVICE_ID; @@ -1361,7 +1359,6 @@ static void usbParseKeyEvent(WacomCommonPtr common, DBG(6, common, "USB 1FG Touch detected %x (value=%d)\n", event->code, event->value); - ds->device_type = TOUCH_ID; ds->device_id = TOUCH_DEVICE_ID; ds->proximity = event->value; } @@ -1375,7 +1372,6 @@ static void usbParseKeyEvent(WacomCommonPtr common, DBG(6, common, "USB Pad detected %x (value=%d)\n", event->code, event->value); - ds->device_type = PAD_ID; ds->device_id = PAD_DEVICE_ID; ds->proximity = (event->value != 0); break; @@ -1386,7 +1382,6 @@ static void usbParseKeyEvent(WacomCommonPtr common, DBG(6, common, "USB Touch detected %x (value=%d)\n", event->code, event->value); - ds->device_type = TOUCH_ID; ds->device_id = TOUCH_DEVICE_ID; ds->proximity = event->value; /* time stamp for 2FGT gesture events */ @@ -1399,7 +1394,6 @@ static void usbParseKeyEvent(WacomCommonPtr common, DBG(6, common, "USB Touch second finger detected %x (value=%d)\n", event->code, event->value); - ds->device_type = TOUCH_ID; ds->device_id = TOUCH_DEVICE_ID; ds->proximity = event->value; /* time stamp for 2GT gesture events */ @@ -1525,13 +1519,27 @@ static int deviceTypeFromEvent(WacomCommonPtr common, int type, int code, int va case BTN_TOOL_FINGER: if ((common->wcmProtocolLevel != WCM_PROTOCOL_GENERIC) - && !private->wcmUseMT) + && !private->wcmUseMT) /* this isn't in usbParseKeyEvent() */ return PAD_ID; else return TOUCH_ID; case BTN_TOOL_RUBBER: return ERASER_ID; + + case BTN_TOOL_DOUBLETAP: + case BTN_TOOL_TRIPLETAP: + return TOUCH_ID; + + case BTN_TOUCH: + if (common->wcmProtocolLevel == WCM_PROTOCOL_GENERIC && + /* 1FG USB touchscreen */ + !TabletHasFeature(common, WCM_PEN) && + TabletHasFeature(common, WCM_1FGT) && + TabletHasFeature(common, WCM_LCD)) + return TOUCH_ID; + else + break; } } else if (type == EV_ABS) { @@ -1687,9 +1695,12 @@ static void usbDispatchEvents(InputInfoPtr pInfo) ds = &common->wcmChannel[channel].work; dslast = common->wcmChannel[channel].valid.state; + if (ds->device_type && ds->device_type != private->wcmDeviceType) + LogMessageVerbSigSafe(X_ERROR, 0, + "usbDispatchEvents: Device Type mismatch - %d -> %d. This is a BUG.\n", + ds->device_type, private->wcmDeviceType); /* no device type? */ if (!ds->device_type && private->wcmDeviceType) { - /* tool was on tablet at startup, force type and proximity */ ds->device_type = private->wcmDeviceType; ds->proximity = 1; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor