From abab7f1609500aa7066812d504ebab7647159843 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 13 Jul 2018 16:24:04 +1000 Subject: [PATCH] test: handle ABS_MT_TOOL_TYPE from the litest devices 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 --- test/litest.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test/litest.c b/test/litest.c index d07725da..da010ada 100644 --- a/test/litest.c +++ b/test/litest.c @@ -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++; @@ -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)