XInput 2 Multi-touch maxing out at 32 touch-points

Peter Hutterer peter.hutterer at who-t.net
Thu May 28 00:08:18 UTC 2020


On Wed, May 27, 2020 at 11:50:43AM -0600, Alex Averill wrote:
> Hello Peter,
> I apologize for the delay in responding to this, I hit a bug that I wanted
> to track down and wasn't able to get access to the hardware again until
> earlier today.
> 
> When I run libinput record I end up hitting a Max of 16 point and hit an
> assertion that fails:
> 
> libinput-record: ../tools/libinput-record.c:385: handle_evdev_frame:
> Assertion `slot < sizeof(d->touch.slot_state) * 8' failed.
> 
> I was able to track that to the file that the error is mentioning (
> https://gitlab.freedesktop.org/libinput/libinput/-/blob/master/tools/libinput-record.c#L385
> ).
> 
> I was also able to recompile libinput and remove that assertion. By
> removing that assertion I was able to record 80 touchpoints. 

ftr, if you just remove the assertion but don't change the size of the
slot_state and last_slot_state fields, you're writing up to 80 bits into a
16-bit field. Which can have interesting side-effects for obvious reasons.

> Would you be able to provide some guidance on what removing that assertion
> may have on other portions of libinput? I would be happy to work through
> the necessary work for testing and then submit a pull request, though this
> would be my first work on Libinput.

changing that to a larger field is a simple and self-contained change. I'd
say uint32_t or uint64_t if really need be - your efforts to record 80
touches are appreciated but I'd rather limit myself to 32 or 64 here to keep
the code simpler :)
Having said that libinput record is a debugging tool and has no effect on
or interaction with libinput (the library) itself. Which means that whatever
bug you were encountering before is still there, you just found another one
in a standalone tool.

Cheers,
   Peter

> 
> On Thu, May 14, 2020 at 12:59 AM Peter Hutterer <peter.hutterer at who-t.net>
> wrote:
> 
> > On Tue, May 12, 2020 at 04:06:17PM -0600, Alex Averill wrote:
> > > Hello,
> > > I am currently working on building an application using XInput 2 and
> > > RawTouch events to capture touch positions and pass them to another
> > > application. I am using a 3M Touchscreen that is reporting through X11
> > that
> > > it supports 80 points, however I am only ever able to capture at most 32
> > > touchpoints.
> >
> > 32 sounds suspiciously like a mask somewhere but I couldn't find
> > anything skimming over the relevant bits.. Are you getting 32 slots from
> > the device though? libinput record will tell you, look at the
> > ABS_MT_SLOT value and inside that the ABS_MT_TRACKING_ID. Any slot with
> > a tracking ID != -1 has a current touch, check how many you can produce.
> > libinput record output is YAML and easy enough to parse.
> >
> > Cheers,
> >   Peter
> >
> > > Is there an inherent limit to the total number of
> > > touchpoints/RawTouchEvents supported by XInput 2?
> > >
> > > Thanks,
> > > Alex Averill
> >
> > > _______________________________________________
> > > xorg at lists.x.org: X.Org support
> > > Archives: http://lists.freedesktop.org/archives/xorg
> > > Info: https://lists.x.org/mailman/listinfo/xorg
> > > Your subscription address: %(user_address)s
> >
> >


More information about the xorg mailing list