Skip to content

Commit

Permalink
input-raw: fix pressure capable multitouch devices
Browse files Browse the repository at this point in the history
  • Loading branch information
merge committed Mar 30, 2017
1 parent 5cd5add commit e47df79
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions plugins/input-raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,27 +263,28 @@ 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.
*/
if ((absbit[BIT_WORD(ABS_MT_POSITION_X)] & BIT_MASK(ABS_MT_POSITION_X)) &&
(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");

Expand Down

0 comments on commit e47df79

Please sign in to comment.