[PATCH xf86-input-evdev] Copy last valuator values into new touch valuator masks

Chase Douglas chase.douglas at canonical.com
Thu Jan 5 11:55:02 PST 2012


On 01/03/2012 05:52 PM, Chase Douglas wrote:
> Evdev is a 100% stateful protocol. The following is correct, and
> represents a double tap:
> 
> ABS_MT_SLOT		0	/* Set touch slot */
> ABS_MT_TRACKING_ID	0	/* New touch with ID 0 in slot 0 */
> ABS_MT_POSITION_X	500	/* Initial X position */
> ABS_MT_POSITION_Y	500	/* Initial Y position */
> SYNC				/* End of frame */
> ABS_MT_TRACKING_ID	-1	/* Touch in last slot (0) ended */
> SYNC				/* End of frame */
> ABS_MT_TRACKING_ID	1	/* New touch in last slot (0) with ID 1 */
> SYNC				/* End of frame */
> ABS_MT_TRACKING_ID	-1	/* Touch in last slot (0) ended */
> SYNC				/* End of frame */
> 
> Note that touch 1 has the same X and Y position as touch 0. This is
> implied because no new value was emitted. In fact, evdev will not emit
> an event with the same value as the previous event, even if the driver
> reports the event, so we can only assume that all the MT valuators have
> the same values as they were when they were last sent.
> 
> This change adds a new valuator mask to hold all the last valuator
> values that came from evdev. When a new touch begins, all the last
> values are copied into it.

This isn't quite correct. While the evdev event list above is accurate,
it only captures part of the issue. The valuator values for a given slot
must be assumed to be the last values given for that specific slot
unless a new value comes in. So:

ABS_MT_SLOT		0	/* Set touch slot */
ABS_MT_TRACKING_ID	0	/* New touch with ID 0 in slot 0 */
ABS_MT_POSITION_X	500	/* Initial X position */
ABS_MT_POSITION_Y	500	/* Initial Y position */
ABS_MT_SLOT		1	/* Set touch slot */
ABS_MT_TRACKING_ID	1	/* New touch with ID 1 in slot 1 */
ABS_MT_POSITION_X	1000	/* Initial X position */
ABS_MT_POSITION_Y	1000	/* Initial Y position */
SYNC				/* End of frame */
ABS_MT_SLOT		0	/* Go back to slot 0 */
ABS_MT_TRACKING_ID	-1	/* Touch in slot 0 ended */
ABS_MT_SLOT		1	/* Go to slot 1 */
ABS_MT_TRACKING_ID	-1	/* Touch in slot 1 ended */
SYNC				/* End of frame */
ABS_MT_SLOT		0	/* Go back to slot 0 */
ABS_MT_TRACKING_ID	2	/* New touch in slot 0 with ID 2 */
SYNC				/* End of frame */
ABS_MT_TRACKING_ID	-1	/* Touch in last slot (0) ended */
SYNC				/* End of frame */

Here, the touch with tracking ID 2 occurs at (500, 500) because those
were the last coordinates given for slot 0.

I will fix this patch up and resend.

-- Chase


More information about the xorg-devel mailing list