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.

BUG=chrome-os-partner:53064
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.

Change-Id: I492af7ae83be542b5fb1fd22fdaa856884d569a3
Signed-off-by: Charlie Mooney <charliemooney@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/360149
Reviewed-by: Dennis Kempin <denniskempin@google.com>
1 file changed
tree: 5217e10db078f74c08b42b20db97c0118be58ef9
  1. Makefile
  2. common.mk
  3. include/
  4. libevdev-cros.pc
  5. src/