From: Chris Bagwell <[email protected]>

This allows unknown touchscreens to work as expected (default to
absolute mode for example).  We no longer need to update case
statement in wcmDeviceTypeKeys() each time a new ID is used with
new hardware.

Signed-off-by: Chris Bagwell <[email protected]>
Reviewed-by: Peter Hutterer <[email protected]>
---

Addressed Peter's review comments.

Also, I used MaskSet() in this patch to set tablet_type but still
kept Peter's Reviewed-by.  If you don't like MaskSet() in other patch
then please reject this patch as well.

 src/wcmUSB.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index 0ea7737..db70f94 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -1613,8 +1613,18 @@ static void usbDispatchEvents(InputInfoPtr pInfo)
                wcmEvent(common, private->wcmBTNChannel, btn_ds);
 }
 
-/* Quirks to unify the tool types for GENERIC protocol tablet PCs */
-static void usbGenericTouchscreenQuirks(unsigned long *keys, unsigned long 
*abs)
+/* Quirks to unify the tool and tablet types for GENERIC protocol tablet PCs
+ *
+ * @param[in,out] keys Contains keys queried from hardware. If a
+ *   touchscreen is detected, keys are modified to add BTN_TOOL_FINGER so
+ *   that a TOUCH device is created later.
+ * @param[in] abs Used to detect multi-touch touchscreens.  When detected,
+ *   updates keys to add possibly missing BTN_TOOL_DOUBLETAP.
+ * @param[in,out] tablet_type When touchscreen is detected, adds WCM_TPC to
+ *   tablet_type so correct defaults, such as absolute mode, are used.
+ */
+static void usbGenericTouchscreenQuirks(unsigned long *keys,
+                                       unsigned long *abs, int *tablet_type)
 {
        /* USB Tablet PC single finger touch devices do not emit
         * BTN_TOOL_FINGER since it is a touchscreen device.
@@ -1622,7 +1632,10 @@ static void usbGenericTouchscreenQuirks(unsigned long 
*keys, unsigned long *abs)
        if (ISBITSET(keys, BTN_TOUCH) &&
                        !ISBITSET(keys, BTN_TOOL_FINGER) &&
                        !ISBITSET(keys, BTN_TOOL_PEN))
+       {
                SETBIT(keys, BTN_TOOL_FINGER); /* 1FGT */
+               MaskSet(*tablet_type, WCM_TPC);
+       }
 
        /* Serial Tablet PC two finger touch devices do not emit
         * BTN_TOOL_DOUBLETAP since they are not touchpads.
@@ -1672,7 +1685,8 @@ static int usbProbeKeys(InputInfoPtr pInfo)
        if (!ISBITSET(abs, ABS_MISC))
        {
                common->wcmProtocolLevel = WCM_PROTOCOL_GENERIC;
-               usbGenericTouchscreenQuirks(common->wcmKeys, abs);
+               usbGenericTouchscreenQuirks(common->wcmKeys, abs,
+                                           &common->tablet_type);
        }
 
        common->vendor_id = wacom_id.vendor;
-- 
1.7.5.2


------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to