From: Egbert Eich <e...@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 <e...@suse.com>
Reviewed-by: Jason Gerecke <killert...@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;
 
-- 
1.8.4.5


------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to