From e47df79dc0c28f1799fb0bcf60c0819906424485 Mon Sep 17 00:00:00 2001 From: Martin Kepplinger Date: Thu, 30 Mar 2017 15:31:37 +0200 Subject: [PATCH] input-raw: fix pressure capable multitouch devices --- plugins/input-raw.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/plugins/input-raw.c b/plugins/input-raw.c index 5956a21d..ae4f0624 100644 --- a/plugins/input-raw.c +++ b/plugins/input-raw.c @@ -263,14 +263,6 @@ static int check_fd(struct tslib_input *i) /* read device info and set special device nr */ get_special_device(i); - /* Since some touchscreens (eg. infrared) physically can't measure pressure, - * the input system doesn't report it on those. Tslib relies on pressure, thus - * we set it to constant 255. It's still controlled by BTN_TOUCH/BTN_LEFT - - * when not touched, the pressure is forced to 0. - */ - if (!(absbit[BIT_WORD(ABS_PRESSURE)] & BIT_MASK(ABS_PRESSURE))) - i->no_pressure = 1; - /* Remember whether we have a multitouch device. We need to know for ABS_X, * ABS_Y and ABS_PRESSURE data. */ @@ -278,12 +270,21 @@ static int check_fd(struct tslib_input *i) (absbit[BIT_WORD(ABS_MT_POSITION_Y)] & BIT_MASK(ABS_MT_POSITION_Y))) i->mt = 1; - /* remember if we have a device that doesn't support pressure. We have to - * set pressure ourselves in this case. + /* Since some touchscreens (eg. infrared) physically can't measure pressure, + * the input system doesn't report it on those. Tslib relies on pressure, thus + * we set it to constant 255. It's still controlled by BTN_TOUCH/BTN_LEFT - + * when not touched, the pressure is forced to 0. */ - if (i->mt && !(absbit[BIT_WORD(ABS_MT_PRESSURE)] & BIT_MASK(ABS_MT_PRESSURE))) + if (!(absbit[BIT_WORD(ABS_PRESSURE)] & BIT_MASK(ABS_PRESSURE))) i->no_pressure = 1; + if (i->mt) { + if (!(absbit[BIT_WORD(ABS_MT_PRESSURE)] & BIT_MASK(ABS_MT_PRESSURE))) + i->no_pressure = 1; + else + i->no_pressure = 0; + } + if ((ioctl(ts->fd, EVIOCGBIT(EV_SYN, sizeof(synbit)), synbit)) == -1) fprintf(stderr, "tslib: ioctl error\n");