diff options
author | Egbert Eich <eich@suse.com> | 2014-03-17 21:08:40 +0100 |
---|---|---|
committer | Jason Gerecke <killertofu@gmail.com> | 2014-03-19 15:42:37 -0700 |
commit | 9765439856149570be41d1e2f2492e620822d492 (patch) | |
tree | 3705d60007486e1bd26b233855abbc840563829f /test | |
parent | 62f912422bc428d2c7f2df71b164a956e895f29d (diff) | |
download | xf86-input-wacom-9765439856149570be41d1e2f2492e620822d492.tar.gz |
Attempt to not lose events to pressure recalibration
Worn out devices send a non-zero pressure even when not in contact
with the tablet. To compensate for this the driver detects if the
pressure sent by the device immediately after indicating proximity
is non-zero. It subtracts this value from any pressure value sent
later and rescales the pressure range to the full device range.
If it later on sees the pressure value fall below this initial value
it will readjust it this lower value.
The downside of this is that when the pen is pushed onto the tablet
really fast the initial pressure reading may be non-zero also the
pen isn't worn. This can lead to lost events.
This patch tries to address this:
If the first pressure reading is != 0 it is recorded. If the recorded
maximum value is >0 but a later pressure reading is higher the maximum
value is replaced. If no button press event is generated the 'normal'
way it is checked of the recorded maximum would trigger one when
minPressure decreases.
Once a 'normal' button event is generated or an 'alternative' button
event is generated and minPressure doesn't decrease any more the
recorded maximum is set to 0 which will disable the checks until the
next prox in.
Signed-off-by: Egbert Eich <eich@suse.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/wacom-tests.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/test/wacom-tests.c b/test/wacom-tests.c index f44d3ab..a245021 100644 --- a/test/wacom-tests.c +++ b/test/wacom-tests.c @@ -179,7 +179,6 @@ test_normalize_pressure(void) InputInfoRec pInfo = {0}; WacomDeviceRec priv = {0}; WacomCommonRec common = {0}; - WacomDeviceState ds = {0}; int pressure, prev_pressure = -1; int i, j; @@ -198,9 +197,9 @@ test_normalize_pressure(void) for (i = 0; i <= common.wcmMaxZ; i++) { - ds.pressure = i; + pressure = i; - pressure = normalizePressure(&priv, &ds); + pressure = normalizePressure(&priv, pressure); assert(pressure >= 0); assert(pressure <= FILTER_PRESSURE_RES); @@ -216,14 +215,12 @@ test_normalize_pressure(void) * minPressure and ignores actual pressure. This would be a bug in the * driver code, but we might as well test for it. */ priv.minPressure = 10; - ds.pressure = 0; - prev_pressure = normalizePressure(&priv, &ds); + prev_pressure = normalizePressure(&priv, 0); for (i = 0; i < priv.minPressure; i++) { - ds.pressure = i; - pressure = normalizePressure(&priv, &ds); + pressure = normalizePressure(&priv, i); assert(pressure >= 0); assert(pressure < FILTER_PRESSURE_RES); |