From c65c8bcc21727839a16fccdc869f27d878ad92ac Mon Sep 17 00:00:00 2001 From: Jason Gerecke Date: Fri, 9 May 2014 15:52:15 -0700 Subject: [PATCH] Use ABS_MT_TOUCH_MAJOR even without ABS_MT_TOUCH_MINOR The kernel allows the latter to be omitted "if the contact is circular", so copy the data from the former if available. Signed-off-by: Jason Gerecke Signed-off-by: Peter Hutterer --- tools/mtview.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/mtview.c b/tools/mtview.c index 69a968a..faa9a35 100644 --- a/tools/mtview.c +++ b/tools/mtview.c @@ -181,9 +181,11 @@ static void output_touch(const struct touch_info *touch_info, minor = DEFAULT_WIDTH_MULTIPLIER * t->data[ABS_MT_PRESSURE] * dx; angle = 0; } - if (touch_info->has_touch_major && touch_info->has_touch_minor) { - major = t->data[ABS_MT_TOUCH_MAJOR]; - minor = t->data[ABS_MT_TOUCH_MINOR]; + + if (touch_info->has_touch_major) { + major = minor = t->data[ABS_MT_TOUCH_MAJOR]; + if (touch_info->has_touch_minor) + minor = t->data[ABS_MT_TOUCH_MINOR]; angle = t->data[ABS_MT_ORIENTATION]; } if (major == 0 && minor == 0) {