Skip to content

Commit

Permalink
test: handle ABS_MT_TOOL_TYPE from the litest devices
Browse files Browse the repository at this point in the history
We want to autoreplace this value where possible but not scale it to min/max,
this is effectively an enum. The same is true for slot/tracking id, so let's
add it here too.

Because it's an enum and 99% of the cases require MT_TOOL_FINGER, we always
fall back to that instead of using the axis_defaults that we use for other
axes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
  • Loading branch information
whot committed Aug 3, 2018
1 parent 2855e26 commit abab7f1
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion test/litest.c
Expand Up @@ -1752,7 +1752,16 @@ axis_replacement_value(struct litest_device *d,

while (axis->evcode != -1) {
if (axis->evcode == evcode) {
*value = litest_scale(d, evcode, axis->value);
switch (evcode) {
case ABS_MT_SLOT:
case ABS_MT_TRACKING_ID:
case ABS_MT_TOOL_TYPE:
*value = axis->value;
break;
default:
*value = litest_scale(d, evcode, axis->value);
break;
}
return true;
}
axis++;
Expand Down Expand Up @@ -1792,6 +1801,10 @@ litest_auto_assign_value(struct litest_device *d,
case ABS_MT_DISTANCE:
value = touching ? 0 : 1;
break;
case ABS_MT_TOOL_TYPE:
if (!axis_replacement_value(d, axes, ev->code, &value))
value = MT_TOOL_FINGER;
break;
default:
if (!axis_replacement_value(d, axes, ev->code, &value) &&
d->interface->get_axis_default)
Expand Down

0 comments on commit abab7f1

Please sign in to comment.