Skip to content

Commit

Permalink
Input: appletouch - improve finger detection
Browse files Browse the repository at this point in the history
The appletouch driver is prone to reporting multiple fingers when only
one is pressing.  The appletouch driver queries an array of pressure
sensors and counts local maxima in pressure to determine the number of
fingers.  It just does this on the raw values, so a data stream like:

0 100 250 300 299 300 250 100 0

actually registers as 2 fingers.

This patch updates the logic to ignore small dips in pressure that are
less than the threshold.

Signed-off-by: Jeremy Huddleston <jeremyhu@freedesktop.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
Jeremy Huddleston authored and Dmitry Torokhov committed Jun 3, 2009
1 parent a862952 commit 05e882f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/input/mouse/appletouch.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact,
(!is_increasing && xy_sensors[i - 1] < xy_sensors[i])) {
(*fingers)++;
is_increasing = 1;
} else if (i > 0 && xy_sensors[i - 1] >= xy_sensors[i]) {
} else if (i > 0 && (xy_sensors[i - 1] - xy_sensors[i] > threshold)) {
is_increasing = 0;
}

Expand Down

0 comments on commit 05e882f

Please sign in to comment.