From 40b3cd568e8cc64a5f7f748f2003d90aa5e738ef Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Sun, 11 Apr 2010 01:25:50 +0200 Subject: Add robust position event filtering The kernel filtering is bypassed for MT events. This patch reintroduces filtering at the earliest possible point, right after the fingers have been identified. For drivers that do not set proper fuzz parameters, sensible values are derived based on a generic signal-to-noise ratio. The defuzz code is borrowed from the Linux kernel, thanks GPL. Signed-off-by: Henrik Rydberg --- src/capabilities.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/capabilities.c') diff --git a/src/capabilities.c b/src/capabilities.c index 7316f01..620ab60 100644 --- a/src/capabilities.c +++ b/src/capabilities.c @@ -26,6 +26,8 @@ #define ADDCAP(s, c, x) strcat(s, c->has_##x ? " " #x : "") +static const int SN_COORD = 250; /* coordinate signal-to-noise ratio */ + static const int bits_per_long = 8 * sizeof(long); static inline int nlongs(int nbit) @@ -78,6 +80,13 @@ int read_capabilities(struct Capabilities *cap, int fd) cap->has_mtdata = cap->has_position_x && cap->has_position_y; + cap->xfuzz = cap->abs_position_x.fuzz; + cap->yfuzz = cap->abs_position_y.fuzz; + if (cap->xfuzz <= 0 || cap->yfuzz <= 0) { + cap->xfuzz = get_cap_xsize(cap) / SN_COORD; + cap->yfuzz = get_cap_ysize(cap) / SN_COORD; + } + return 0; } -- cgit v1.2.3