Hi Chris,

I like the concept of this patchset. Patch one looks fine. I have some
comments for this one inline.

Thank you.

Ping

On Tue, Dec 28, 2010 at 5:10 PM,  <ch...@cnpbagwell.com> wrote:
> From: Chris Bagwell <ch...@cnpbagwell.com>
>
> BTN_TOOL_FINGER/DOUBLETAP/TRIPLETAP have incompatible meanings
> between generic and protocol 4/5 devices.  Add logic to give
> rough value of wcmProtocolLevel when probing wcmKeys (can't
> tell difference between 4 and 5 which is OK at this level).
>
> Use this rough value to generic set 1FGT and 2FGT features.
>
> Any new MT touchpad using ABS_MT_SLOT will now work without
> modification to xf86-input-wacom.
>
> Any new protocol 4 touchpad using TRIPLETAP or DOUBLETAP will
> also now work without modification to xf86-input-wacom.
>
> Touchscreens will work in relative mode because currently only
> tablet_id informs this.  Generic protocols may eventually have
> something in kernel that can be queried for touchscreen vs.
> touchpad.
>
> Signed-off-by: Chris Bagwell <ch...@cnpbagwell.com>
> ---
>  src/wcmISDV4.c          |    3 +++
>  src/wcmUSB.c            |   16 ++++++++++++++++
>  src/wcmValidateDevice.c |   31 +++++++++++++++++++------------
>  3 files changed, 38 insertions(+), 12 deletions(-)
>
> diff --git a/src/wcmISDV4.c b/src/wcmISDV4.c
> index 2c3ca9a..6c50dfb 100644
> --- a/src/wcmISDV4.c
> +++ b/src/wcmISDV4.c
> @@ -942,6 +942,9 @@ static int isdv4ProbeKeys(InputInfoPtr pInfo)
>        SETBIT(common->wcmKeys, BTN_TOOL_PEN);
>        SETBIT(common->wcmKeys, BTN_TOOL_RUBBER);
>
> +       /* wcmKeys are based on Protocol 4 meanings */

Can you elaborate this comment a little bit? I can not link wcmKeys
directly to Protocol 4 somehow. I can link wcmKeys to
WCM_PROTOCOL_GENERIC though.

> +       common->wcmProtocolLevel = WCM_PROTOCOL_4;

wcmProtocolLevel defaults to WCM_PROTOCOL_4. Why do we need to reassign it here?

> +
>        if (model->set_bits)
>                tablet_id = model->set_bits(id, common->wcmKeys);
>
> diff --git a/src/wcmUSB.c b/src/wcmUSB.c
> index c25e67c..9341ee4 100644
> --- a/src/wcmUSB.c
> +++ b/src/wcmUSB.c
> @@ -1358,12 +1358,15 @@ static void usbDispatchEvents(InputInfoPtr pInfo)
>  * Query the device's fd for the key bits and the tablet ID. Returns the ID
>  * on success or 0 on failure.
>  * For USB devices, we simply copy the information the kernel gives us.
> + * Since keys have different meanings between protocol 4/5 and generic,
> + * assign that a rough value here.
>  */
>  static int usbProbeKeys(InputInfoPtr pInfo)
>  {
>        struct input_id wacom_id;
>        WacomDevicePtr  priv = (WacomDevicePtr)pInfo->private;
>        WacomCommonPtr  common = priv->common;
> +       unsigned long abs[NBITS(ABS_MAX)] = {0};
>
>        if (ioctl(pInfo->fd, EVIOCGBIT(EV_KEY, (sizeof(unsigned long)
>                                                * NBITS(KEY_MAX))), 
> common->wcmKeys) < 0)
> @@ -1380,6 +1383,19 @@ static int usbProbeKeys(InputInfoPtr pInfo)
>                return 0;
>        }
>
> +        if (ioctl(pInfo->fd, EVIOCGBIT(EV_ABS, sizeof(abs)), abs) < 0)
> +       {
> +               xf86Msg(X_ERROR, "%s: usbProbeKeys unable to ioctl "
> +                       "abs bits.\n", pInfo->name);
> +               return 0;
> +       }
> +
> +       /* A generic protocol device does not report ABS_MISC event */
> +       if (ISBITSET(abs, ABS_MISC))
> +               common->wcmProtocolLevel = WCM_PROTOCOL_4;
> +       else
> +               common->wcmProtocolLevel = WCM_PROTOCOL_GENERIC;
> +

Is

   if (!ISBITSET(abs, ABS_MISC))
              common->wcmProtocolLevel = WCM_PROTOCOL_GENERIC;

enough? wcmProtocolLevel defaults to WCM_PROTOCOL_4 anyway. If you
prefer your way, I am fine.

>        return wacom_id.product;
>  }
>
> diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c
> index b7312a3..9e0cca3 100644
> --- a/src/wcmValidateDevice.c
> +++ b/src/wcmValidateDevice.c
> @@ -256,28 +256,16 @@ int wcmDeviceTypeKeys(InputInfoPtr pInfo)
>                case 0xE3: /* TPC with 2FGT */
>                        priv->common->tablet_type = WCM_TPC;
>                        priv->common->tablet_type |= WCM_LCD;
> -                       /* fall through */
> -               case 0xD0:  /* Bamboo with 2FGT */
> -               case 0xD1:  /* Bamboo with 2FGT */
> -               case 0xD2:  /* Bamboo with 2FGT */
> -               case 0xD3:  /* Bamboo with 2FGT */
> -               case 0xD8:  /* Bamboo with 2FGT */
> -               case 0xDA:  /* Bamboo with 2FGT */
> -               case 0xDB:  /* Bamboo with 2FGT */
> -                       priv->common->tablet_type |= WCM_2FGT;
>                        break;
>
>                case 0x93: /* TPC with 1FGT */
>                case 0x9A: /* TPC with 1FGT */
> -                       priv->common->tablet_type = WCM_1FGT;
> -                       /* fall through */
>                case 0x90: /* TPC */
>                        priv->common->tablet_type |= WCM_TPC;
>                        priv->common->tablet_type |= WCM_LCD;
>                        break;
>
>                case 0x9F:
> -                       priv->common->tablet_type = WCM_1FGT;
>                        priv->common->tablet_type |= WCM_LCD;
>                        break;
>
> @@ -291,6 +279,25 @@ int wcmDeviceTypeKeys(InputInfoPtr pInfo)
>                priv->common->tablet_type |= WCM_PAD;
>        }
>
> +       /* Protocol 4 TRIPLETAP means 2 finger touch. */
> +       if (common->wcmProtocolLevel == WCM_PROTOCOL_4 &&
> +           ISBITSET(common->wcmKeys, BTN_TOOL_TRIPLETAP))
> +       {
> +               priv->common->tablet_type |= WCM_2FGT;
> +       }
> +       /* Protocol 4 DOUBLETAP without TRIPLETAP means 1 finger touch */
> +       else if (common->wcmProtocolLevel == WCM_PROTOCOL_4 &&
> +                ISBITSET(common->wcmKeys, BTN_TOOL_DOUBLETAP))
> +       {
> +               priv->common->tablet_type |= WCM_1FGT;
> +       }

Does the following work for you?

+       if (common->wcmProtocolLevel == WCM_PROTOCOL_4)
+       {
+           /* Protocol 4 TRIPLETAP means 2 finger touch. */
+           if(ISBITSET(common->wcmKeys, BTN_TOOL_TRIPLETAP))
+                 priv->common->tablet_type |= WCM_2FGT;
+           /* Protocol 4 DOUBLETAP without TRIPLETAP means 1 finger touch */
+          else if (ISBITSET(common->wcmKeys, BTN_TOOL_DOUBLETAP))
+                 priv->common->tablet_type |= WCM_1FGT;
+       }

> +
> +       if (common->wcmProtocolLevel == WCM_PROTOCOL_GENERIC)
> +       {
> +               if (ISBITSET(common->wcmKeys, BTN_TOOL_DOUBLETAP))
> +                       priv->common->tablet_type |= WCM_2FGT;
> +       }

Can we use MT slot number for WCM_2FGT? It would be easier to add
3FGT, 4FGT, etc. when needed later. Also, should we set WCM_1FGT
feature for single touch devices in GENERIC protocol? Bamboo does not
have one finger. But others have. BTN_TOOL_FINGER (for GENERIC type,
this key is safe ;) can be used for this purpose.

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to