From: Chris Bagwell <ch...@cnpbagwell.com>

Initial changes to support Bamboo Touch input device
reporting values using a touchpad-like event interface
and MT events for multitouch.  This change is backwards
compatible with original "serial #" style multiplexing of data.

This change allows touchpad to function; including basic
1 finger gestures such as tap-to-click.

Tablet buttons do not work yet because they need to be
rerouted to PAD device.  MT events do not work because
at least the second finger needs to be rerouted to
channel #2.

Signed-off-by: Chris Bagwell <ch...@cnpbagwell.com>
---
 src/wcmUSB.c |   57 +++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 45 insertions(+), 12 deletions(-)

diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index 72adb0b..8f97c73 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -684,6 +684,18 @@ int usbWcmGetRanges(InputInfoPtr pInfo)
        if (ioctl(pInfo->fd, EVIOCGABS(ABS_DISTANCE), &absinfo) == 0)
                common->wcmMaxDist = absinfo.maximum;
 
+       if ((common->tablet_id >= 0xd0) && (common->tablet_id <= 0xd3))
+       {
+               /* Multitouch (MT) version of Bamboo driver does not
+                * use serial # multiplexing scheme for touchpad.
+                * Set wcmProtocolLevel to 0 to indicate no 
+                * serial #/channel support.
+                */
+               if (ISBITSET(common->wcmKeys, BTN_TOOL_DOUBLETAP) &&
+                   !ISBITSET(common->wcmKeys, BTN_TOOL_TRIPLETAP))
+                       common->wcmProtocolLevel = 0;
+       }
+
        return Success;
 }
 
@@ -723,7 +735,13 @@ static int usbChooseChannel(WacomCommonPtr common)
        wcmUSBData* private = common->private;
        int serial = private->wcmLastToolSerial;
 
-       if (common->wcmProtocolLevel == 4)
+       if (common->wcmProtocolLevel == 0)
+       {
+               /* Input devices without protocols default to 1st channel. */
+               channel = 0;
+               serial = 1;
+       }
+       else if (common->wcmProtocolLevel == 4)
        {
                /* Protocol 4 doesn't support tool serial numbers.
                 * However, we pass finger index into serial
@@ -995,17 +1013,6 @@ static void usbParseKeyEvent(WacomCommonPtr common,
         * that map to different channels can be in proximity at same
         * time with no confusion.
         *
-        * TODO: Input devices that do not use Wacom's single device
-        * channel multiplexing scheme will report BTN_TOUCH for same 
-        * meaning we use BTN_TOOL_* and also report tablet button presses
-        * with no BTN_TOOL_FINGER.  As long as these devices do not
-        * have operlapping button reports (see BTN_STYLUS2 and 
-        * BTN_RIGHT as example) then a simple solution may be to treat
-        * BTN_TOUCH as BTN_TOOL_DOUBLETAP for touchpads and
-        * BTN_TOOL_PEN for tablets.  Since touchpads can
-        * send BTN_TOOL_DOUBLETAP for different reason then below case 
-        * statement would need to account for that.
-        *
         * Remaining part of case state (after BTN_TOOL_*) handle normal
         * button presses.
         */
@@ -1051,6 +1058,10 @@ static void usbParseKeyEvent(WacomCommonPtr common,
                        break;
 
                case BTN_TOOL_FINGER:
+                       /* If a real finger report, ignore. */
+                       if (common->wcmProtocolLevel == 0)
+                               break;
+
                        DBG(6, common, 
                            "USB Pad detected %x (value=%d)\n",
                            event->code, event->value);
@@ -1059,7 +1070,25 @@ static void usbParseKeyEvent(WacomCommonPtr common,
                        ds->proximity = (event->value != 0);
                        break;
 
+               case BTN_TOUCH:
+                       /* Treat BTN_TOUCH same as BTN_TOOL_DOUBLETAP
+                        * for touchpads.
+                        * TODO: Tablets that do not use wacom style
+                        * multiplexing over a single input device
+                        * also can report BTN_TOUCH same as
+                        * BTN_TOOL_PEN would be used.  We should
+                        * allow for that case as well.
+                        */ 
+                       if (common->wcmProtocolLevel != 0)
+                               break;
+
+                       /* fall through */
                case BTN_TOOL_DOUBLETAP:
+                       /* If a real double tap report, ignore. */
+                       if (common->wcmProtocolLevel == 0 &&
+                           event->code == BTN_TOOL_DOUBLETAP)
+                               break;
+
                        DBG(6, common, 
                            "USB Touch detected %x (value=%d)\n",
                            event->code, event->value);
@@ -1085,6 +1114,10 @@ static void usbParseKeyEvent(WacomCommonPtr common,
                        break;
 
                case BTN_TOOL_TRIPLETAP:
+                       /* If a real triple tap report, ignore. */
+                       if (common->wcmProtocolLevel == 0)
+                               break;
+
                        DBG(6, common, 
                            "USB Touch second finger detected %x (value=%d)\n",
                            event->code, event->value);
-- 
1.7.2.2


------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to