[PATCH 3/4] Implement MT Slots protocol support

Chase Douglas chase.douglas at canonical.com
Wed Jun 23 08:49:32 PDT 2010


On Wed, 2010-06-23 at 17:25 +0200, Benjamin Tissoires wrote:
> Le 23/06/2010 16:04, Chase Douglas a écrit :
> > @@ -1309,6 +1326,14 @@ EvdevMTInitValuators(DeviceIntPtr device, Atom *atoms)
> >               pEvdev->old_vals[real_axnum] = -1;
> >           }
> >       }
> > +
> > +    /* TRACKING_ID != -1 means touch is down */
> > +    for (j = 0; j<  pEvdev->mt_max_touchpoints; j++) {
> > +        int axnum = pEvdev->axis_map[ABS_MT_TRACKING_ID];
> > +        int real_axnum = axnum + j * pEvdev->mt_num_valuators;
> > +
> > +        pEvdev->vals[real_axnum] = -1;
> > +    }
> 
> Ouch, I just saw that:
> if the device reports its trackingID between 0 and 15 (for instance the 
> magicmouse), you can not have -1 in the trackingID since the server 
> clamps it at 0.
> 
> We need to call again xf86InitValuatorAxisStruct on each trackingID axis 
> to set its min at -1.
> 
> the patch should be:
> ----------------------------------------------------------------------------
>      /* TRACKING_ID != -1 means touch is down */
>      for (j = 0; j < pEvdev->mt_max_touchpoints; j++) {
>          int axnum = pEvdev->axis_map[ABS_MT_TRACKING_ID];
>          int real_axnum = axnum + j * pEvdev->mt_num_valuators;
> 
>          int resolution = 10000;
> 
> #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 30)
>          /* Kernel provides units/mm, X wants units/m */
>          if (pEvdev->absinfo[ABS_MT_TRACKING_ID].resolution)
>              resolution = pEvdev->absinfo[ABS_MT_TRACKING_ID].resolution 
> * 1000;
> #endif
> 
>           /* We force the trackingID to have a min value of -1 */
>          xf86InitValuatorAxisStruct(device, real_axnum,
> #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
>                                         atoms[axnum],
> #endif
>                                     -1,
>  
> pEvdev->absinfo[ABS_MT_TRACKING_ID].maximum,
>                                     resolution, 0, resolution);
> 
> 
>          pEvdev->vals[real_axnum] = -1;
>      }

Ahhh, I have been testing with a Magic Mouse, which probably doesn't
provide a minimum tracking ID.

I'm thinking that instead of re-initializing the valuator, we just have
a special case in the current init code that checks for axnum ==
ABS_MT_TRACKING_ID and always sets the minimum to -1 in that case.

I'll fix this up asap, but I'll wait for further reviews before flooding
the list with a new set of patches :).

-- Chase



More information about the xorg-devel mailing list