On Monday, December 3, 2012, Peter Hutterer wrote:
> On Mon, Dec 03, 2012 at 08:35:42PM -0800, Ping Cheng wrote:
> > On Monday, December 3, 2012, Peter Hutterer wrote:
> >
> > > On Wed, Nov 21, 2012 at 12:14:53PM -0800, Ping Cheng wrote:
> > > > Clients should know the maximum number of contacts a touch device
> > > > support before they get touch events.
> > > >
> > > > Signed-off-by: Ping Cheng <pi...@wacom.com <javascript:;><javascript:;>>
> > > >
> > > > ---
> > > > The following TO-Do takes more time than I have now. I list it
> > > > here so we do not forget them.
> > > >
> > > > X server supports pointer emulation for touch device. We should
> > > > let X server take care of single touch events for both MT and
> > > > single touch devices that are running on newer servers;
> > > >
> > > > Touch events are currently all posted in relative mode (touchpad).
> > > > We need to support absolute mode (touchscreen) devices.
> > > > ---
> > > > src/wcmUSB.c | 3 +++
> > > > src/xf86Wacom.c | 6 +++++-
> > > > src/xf86WacomDefs.h | 1 +
> > > > 3 files changed, 9 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/src/wcmUSB.c b/src/wcmUSB.c
> > > > index 5cc7830..acce5ee 100644
> > > > --- a/src/wcmUSB.c
> > > > +++ b/src/wcmUSB.c
> > > > @@ -681,6 +681,9 @@ int usbWcmGetRanges(InputInfoPtr pInfo)
> > > > {
> > > > private->wcmUseMT = 1;
> > > >
> > > > + if (!ioctl(pInfo->fd, EVIOCGABS(ABS_MT_SLOT),
> &absinfo))
> > > > + common->wcmMaxContacts = absinfo.maximum + 1;
> > > > +
> > > > /* pen and MT on the same logical port */
> > > > if (ISBITSET(common->wcmKeys, BTN_TOOL_PEN))
> > > > private->wcmPenTouch = TRUE;
> > > > diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c
> > > > index bb11cf4..808f5f8 100644
> > > > --- a/src/xf86Wacom.c
> > > > +++ b/src/xf86Wacom.c
> > > > @@ -323,6 +323,7 @@ static int wcmDevInit(DeviceIntPtr pWcm)
> > > > {
> > > > InputInfoPtr pInfo = (InputInfoPtr)pWcm->public.devicePrivate;
> > > > WacomDevicePtr priv = (WacomDevicePtr)pInfo->private;
> > > > + WacomCommonPtr common = priv->common;
> > > > unsigned char butmap[WCM_MAX_BUTTONS+1];
> > > > int nbaxes, nbbuttons, nbkeys;
> > > > int loop;
> > > > @@ -421,7 +422,10 @@ static int wcmDevInit(DeviceIntPtr pWcm)
> > > >
> > > > #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 16
> > > > if (IsTouch(priv)) {
> > > > - if (!InitTouchClassDeviceStruct(pInfo->dev, 0,
> > > XIDependentTouch, 2)) {
> > > > + if (!common->wcmMaxContacts)
> > > > + common->wcmMaxContacts = 1;
> > >
> > > a default of 0 means "don't know", and we should leave it at that.
> >
> >
> > That is true if we have no idea how many contacts we are going to have.
> > However, when we are inside IsTouch(), we know for sure we have at least
> > one contact. The actual number of contacts will be updated later.
> >
> > Do we still need to leave it at 0?
>
> yes, there is currently no facility in the server to update it later. and
> "at least one" is the same as "don't know" because one would assume that
> any
> touch device has at least one - otherwise it'd be a mouse :)
With your comments, I need to look into the code again. The value should
have been decided before we come to this point. My if-statement meant to be
a safeguard, which is obviously not at the right place.
0 signals to the client that the device doesn't know how many concurrent
> touches this device supports, so they should prepare for the best/worst.
> setting it to 1 but then sending more than one touchpoint is more likely to
> confuse the client.
Makes perfect sense! Thank you for your time.
Ping
> Cheers,
> Peter
>
>
> > > > +
> > > > + if (!InitTouchClassDeviceStruct(pInfo->dev,
> > > common->wcmMaxContacts, XIDependentTouch, 2)) {
> > > > xf86Msg(X_ERROR, "Unable to init touch class
> > > device struct!\n");
> > > > return FALSE;
> > > > }
> > > > diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
> > > > index 7df0e95..abfde70 100644
> > > > --- a/src/xf86WacomDefs.h
> > > > +++ b/src/xf86WacomDefs.h
> > > > @@ -446,6 +446,7 @@ struct _WacomCommonRec
> > > > /* tablet Z resolution is
> equivalent
> > > > * to wcmMaxZ which is equal to
> 100%
> > > pressure */
> > > > int wcmMaxDist; /* tablet max distance value */
> > > > + int wcmMaxContacts; /* MT device max number of
> contacts */
> > > >
> > > > /*
> > > > * TODO Remove wcmTiltOff*, once the kernel drivers reporting
> > > > --
> > > > 1.7.10.4
> > >
>
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel