wcmBTNChannel is only used by generic PAD device.
And it is statically assigned to PAD_CHANNEL. No
need to reassign it for every packet.

Signed-off-by: Ping Cheng <pingli...@gmail.com>
Acked-by: Jason Gerecke <killert...@gmail.com>
---
 src/wcmUSB.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index 4b5f53b..0ea2093 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -448,6 +448,7 @@ static void usbWcmInitPadState(InputInfoPtr pInfo)
 {
        WacomDevicePtr priv = (WacomDevicePtr)pInfo->private;
        WacomCommonPtr common = priv->common;
+       wcmUSBData* private = common->private;
        WacomDeviceState *ds;
        int channel = PAD_CHANNEL;
 
@@ -459,6 +460,12 @@ static void usbWcmInitPadState(InputInfoPtr pInfo)
        ds->device_type = PAD_ID;
        ds->device_id = PAD_DEVICE_ID;
        ds->serial_num = channel;
+
+       /* wcmBTNChannel is only used for generic PAD device
+        * and it is statically assigned to PAD_CHANNEL.
+        */
+       if (common->wcmProtocolLevel == WCM_PROTOCOL_GENERIC)
+               private->wcmBTNChannel = channel;
 }
 
 int usbWcmGetRanges(InputInfoPtr pInfo)
@@ -774,16 +781,12 @@ static int protocol5Serial(int device_type, unsigned int 
serial) {
  */
 static int usbChooseChannel(WacomCommonPtr common, int device_type, unsigned 
int serial)
 {
-       wcmUSBData* private = common->private;
-
        /* figure out the channel to use based on serial number */
        int i, channel = -1;
 
        /* force events from PAD device to PAD_CHANNEL */
-       if (serial == -1) {
+       if (serial == -1)
                channel = PAD_CHANNEL;
-               private->wcmBTNChannel = channel;
-       }
 
        /* find existing channel */
        if (channel < 0)
-- 
1.7.10.4


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to