Only count fingers if they're not hovering
Previously when libevdev was counting how many fingers were on the pad,
it simply counted the number that were reported. This isn't entirely
accurate anymore because we're beginning to get hover-enabled touchpads.
For these touchpads the events like BTN_TOOL_FINGER don't necessarily
mean that the finger it touching the pad, it could be hovering above it.
You can differentiate the hovering fingers from the touching ones by
looking for the presence of BTN_TOUCH = 1, which indicates if it's
touching or hovering.
This CL modifies Event_Get_Touch_Count to always return 0 unless
BTN_TOUCH is one -- indicating that the reported fingers are actually
touching the surface. If it's zero, then we know that any fingers are
hovering, which shouldn't count.
The "gestures" library for ChromeOS requires that touchpads have
BTN_TOUCH in addition to the other BTN events referenced in this CL. A
manual check of an Elan, Atmel, and Cypress touchpad all show the
BTN_TOUCH event appearing as expected, so this should be just fine even
on non-hover devices.
TEST=manually deployed on a device with a hover-enabled touchpad, and
I'm no longer able to tap-to-click without even touching the pad like I
was before. Powerd is also not waking up entirely on hover events now
-- it can differentiate between a hover and a touch.
Signed-off-by: Charlie Mooney <email@example.com>
Reviewed-by: Dennis Kempin <firstname.lastname@example.org>
1 file changed