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>
---
 src/wcmUSB.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index 8520bd1..772ed0f 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);
@@ -1617,8 +1618,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);
 
@@ -1732,6 +1733,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


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to