From: Chris Bagwell <ch...@cnpbagwell.com> usbChooseChannel() supported in most cases 1 input and 1 pad to be concurrently in proximity. DUALINPUT V5 devices (Intuos 1 & 2) could handle a combination 2 inputs and 1 pad, up to max of 2 in proximity at 1 time though.
This change ports over an update from linuxwacom to allow 2 input channels on V4 devices as well as 1 pad to be concurrently in proximity. It gives DUALINPUT V5 a total of 3 as a side affect. This change is required to expose multitouch input to any pending Gesture logic. This is namely for Bamboo P&T and Tablet PC's. Patch also replaces a few magic numbers with #defines to improve understanding. Signed-off-by: Chris Bagwell <ch...@cnpbagwell.com> --- src/wcmUSB.c | 34 ++++++++++++++++++++-------------- src/xf86WacomDefs.h | 8 ++++++-- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/wcmUSB.c b/src/wcmUSB.c index f0321ee..b804aa9 100644 --- a/src/wcmUSB.c +++ b/src/wcmUSB.c @@ -697,13 +697,17 @@ static int usbChooseChannel(WacomCommonPtr common, int serial) if (common->wcmProtocolLevel == 4) { - /* Protocol 4 doesn't support tool serial numbers */ - if (serial == 0xf0) - channel = 1; - else - channel = 0; + /* V4 devices imply serial #1 if not sent */ + if (!serial) + serial = 1; + + if (serial == SINGLEINPUT_PAD_SERIAL) + channel = PAD_CHANNEL; + else if (serial < MAX_CHANNELS) + channel = serial-1; } - else if (serial) /* serial number should never be 0 for V5 devices */ + /* serial number should never be 0 for V5 devices */ + else if (serial) { /* dual input is supported */ if (TabletHasFeature(common, WCM_DUALINPUT)) @@ -712,7 +716,7 @@ static int usbChooseChannel(WacomCommonPtr common, int serial) for (i=0; i<MAX_CHANNELS; ++i) { if (common->wcmChannel[i].work.proximity && - common->wcmChannel[i].work.serial_num == serial) + common->wcmChannel[i].work.serial_num == serial) { channel = i; break; @@ -732,14 +736,16 @@ static int usbChooseChannel(WacomCommonPtr common, int serial) } } } - else /* one transducer plus expresskey (pad) is supported */ + else { - if (serial == -1) /* pad */ - channel = 1; - else if ( (common->wcmChannel[0].work.proximity && /* existing transducer */ - (common->wcmChannel[0].work.serial_num == serial)) || - !common->wcmChannel[0].work.proximity ) /* new transducer */ - channel = 0; + /* One transducer plus expresskey (pad) is supported. + * Second dual input is not used. */ + if (serial == DUALINPUT_PAD_SERIAL) + channel = PAD_CHANNEL; + else if ((common->wcmChannel[0].work.proximity && /* existing transducer */ + (common->wcmChannel[0].work.serial_num == serial)) || + !common->wcmChannel[0].work.proximity ) /* new transducer */ + channel = FIRST_INPUT_CHANNEL; } } diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h index 3d3c176..cbd890c 100644 --- a/src/xf86WacomDefs.h +++ b/src/xf86WacomDefs.h @@ -359,8 +359,12 @@ extern WacomDeviceClass gWacomISDV4Device; #define DEVICE_ISDV4 0x000C -#define MAX_CHANNELS 2 -#define MAX_FINGERS 2 +#define MAX_FINGERS 2 +#define MAX_CHANNELS MAX_FINGERS+1 +#define FIRST_INPUT_CHANNEL 0 +#define PAD_CHANNEL 2 +#define DUALINPUT_PAD_SERIAL -1 +#define SINGLEINPUT_PAD_SERIAL 0xf0 struct _WacomCommonRec { -- 1.7.0.1 ------------------------------------------------------------------------------ _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel