File U_04-Store-the-last-used-channel-rather-than-blindly-taking-channel-0.patch of Package xf86-input-wacom

From: Egbert Eich <eich@suse.com>
Date: Wed Apr 9 21:27:03 2014 +0200
Subject: [PATCH 4/6]Store the last used channel rather than blindly taking channel 0
Patch-Mainline: Upstream
Git-commit: 8f44f3568c46ab9cca543b830fb2e84dd56a2af9
Git-repo: git://linuxwacom.git.sourceforge.net/gitroot/linuxwacom/xf86-input-wacom
References: FATE#
Signed-off-by: Egbert Eich <eich@suse.com>

When an event stream from a device doesn't contain information
on the device type we look at the last used channel and copy
over the device type.
This is acceptable as such a situation only occurs while in
proximity i.e. when the previous command package came from
the same device.
So far the device type form the state in channel 0 was taken.
This was wrong however for PAD devices for instance.

Signed-off-by: Egbert Eich <eich@suse.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
---
 src/wcmUSB.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index b79f0e3..c060ec5 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -41,6 +41,7 @@ typedef struct {
 	int nbuttons;                /* total number of buttons */
 	int npadkeys;                /* number of pad keys in the above array */
 	int padkey_code[WCM_MAX_BUTTONS];/* hardware codes for buttons */
+	int lastChannel;
 } wcmUSBData;
 
 static Bool usbDetect(InputInfoPtr);
@@ -1636,8 +1637,8 @@ static void usbDispatchEvents(InputInfoPtr pInfo)
 	WacomDevicePtr priv = (WacomDevicePtr)pInfo->private;
 	WacomCommonPtr common = priv->common;
 	int channel;
-	WacomDeviceState dslast = common->wcmChannel[0].valid.state;
 	wcmUSBData* private = common->private;
+	WacomDeviceState dslast = common->wcmChannel[private->lastChannel].valid.state;
 
 	DBG(6, common, "%d events received\n", private->wcmEventCnt);
 
@@ -1767,6 +1768,8 @@ static void usbDispatchEvents(InputInfoPtr pInfo)
 	if (!ds->proximity)
 		private->wcmLastToolSerial = 0;
 
+	private->lastChannel = channel;
+
 	for (c = 0; c < MAX_CHANNELS; c++) {
 		ds = &common->wcmChannel[c].work;
 
openSUSE Build Service is sponsored by