HID: ntrig: add sensitivity and responsiveness support
The old rejection size thresholds were too high for the 12" devices.
Larger surfaces like the Dell Studio17 exacerbated the problem since
contact size is reported on the same logical scale, making a contact
look smaller to the larger screen.
Since we have observed erroneous ghost events from these devices we
still need to filter the incoming stream.
The prior size threshold filter is still in place, though with
defaults set to leave it off.
This patch adds the two new classes of filters, those that reject
live frames before activation, and those that reject empty frames
until deactivation. These filters are expressed in terms of a
simple state machine for clarity (I hope).
The activation filter has two components, slack and size, events
are discarded until either is satisfied. Slack is defined as
the number of seemingly good contacts to read before accepting the
stream as valid (if the threshold is reached in the middle of a frame
the remainder of that frame is still discarded).
The deactivation filter discards empty frames until hitting a
deactivate slack. This time measured in frames. N-Trig devices
emit 5-8 (observed so far) empty frames at the end of multitouch
activity. Ignoring the first few enables us to safely and gracefully
handle erroneous empty frames, thus preventing a change in the tool
state which would otherwise result in things like broken lines or
dragged objects being dropped in bad places.
Also, now that devices with different logical densities have
been observed, the aforementioned sizes are scaled from physical
to logical scales once those scales are identified. Hopefully this
should mean that a given threshold value means the same thing across
differing devices.
Signed-off-by: Rafi Rubin <rafi@seas.upenn.edu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>