Discussion:
[Linuxwacom-devel] [PATCH] isdv4: Use last-known event position in touch up events
Jason Gerecke
2016-04-14 16:16:09 UTC
Permalink
Old serial ISDv4 sensors that (still?!) use the driver-internal parsing
routines can inadvertantly send (0,0) coordinates to X on touch up.
Even if a sensor sends (0,0) as the touch up coordinate, the code in
wcmTouchFilter.c should do the right thing by only sending motion
eventions while the touch is down. This isn't the case when in-driver
gestures are disabled though, since motion events (specifically XI_TouchEnd)
will be sent for touch up events as well.

To prevent potential (0,0) coordinates from being emitted on touch up
while in-driver gestures are disabled, we use the last-known touch
position as the current touch position. This mirrors what is done by
the standard input kernel driver (which leaves X/Y at its last known
position on touch up).

Fixes: https://sourceforge.net/p/linuxwacom/bugs/312/

Signed-off-by: Jason Gerecke <***@wacom.com>
---
src/wcmISDV4.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/wcmISDV4.c b/src/wcmISDV4.c
index 95001a1..8cc4483 100644
--- a/src/wcmISDV4.c
+++ b/src/wcmISDV4.c
@@ -625,8 +625,8 @@ static int isdv4ParseTouchPacket(InputInfoPtr pInfo, const unsigned char *data,
return -1;
}

- ds->x = touchdata.x;
- ds->y = touchdata.y;
+ ds->x = touchdata.status ? touchdata.x : last->x;
+ ds->y = touchdata.status ? touchdata.y : last->y;
ds->proximity = touchdata.status;
ds->device_type = TOUCH_ID;
ds->device_id = TOUCH_DEVICE_ID;
@@ -651,8 +651,8 @@ static int isdv4ParseTouchPacket(InputInfoPtr pInfo, const unsigned char *data,
channel = 1;
ds = &common->wcmChannel[channel].work;
RESET_RELATIVE(*ds);
- ds->x = touchdata.finger2.x;
- ds->y = touchdata.finger2.y;
+ ds->x = touchdata.finger2.status ? touchdata.finger2.x : lastTemp->x;
+ ds->y = touchdata.finger2.status ? touchdata.finger2.y : lastTemp->y;
ds->device_type = TOUCH_ID;
ds->device_id = TOUCH_DEVICE_ID;
ds->serial_num = 2;
--
2.8.0
Ping Cheng
2016-04-14 17:09:41 UTC
Permalink
Post by Jason Gerecke
Old serial ISDv4 sensors that (still?!) use the driver-internal parsing
routines can inadvertantly send (0,0) coordinates to X on touch up.
Even if a sensor sends (0,0) as the touch up coordinate, the code in
wcmTouchFilter.c should do the right thing by only sending motion
eventions while the touch is down. This isn't the case when in-driver
gestures are disabled though, since motion events (specifically XI_TouchEnd)
will be sent for touch up events as well.
To prevent potential (0,0) coordinates from being emitted on touch up
while in-driver gestures are disabled, we use the last-known touch
position as the current touch position. This mirrors what is done by
the standard input kernel driver (which leaves X/Y at its last known
position on touch up).
Sounds sensible to me.
Post by Jason Gerecke
Fixes: https://sourceforge.net/p/linuxwacom/bugs/312/
Reviewed-by: Ping Cheng <***@gmail.com>

Ping
Post by Jason Gerecke
---
src/wcmISDV4.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/wcmISDV4.c b/src/wcmISDV4.c
index 95001a1..8cc4483 100644
--- a/src/wcmISDV4.c
+++ b/src/wcmISDV4.c
@@ -625,8 +625,8 @@ static int isdv4ParseTouchPacket(InputInfoPtr pInfo, const unsigned char *data,
return -1;
}
- ds->x = touchdata.x;
- ds->y = touchdata.y;
+ ds->x = touchdata.status ? touchdata.x : last->x;
+ ds->y = touchdata.status ? touchdata.y : last->y;
ds->proximity = touchdata.status;
ds->device_type = TOUCH_ID;
ds->device_id = TOUCH_DEVICE_ID;
@@ -651,8 +651,8 @@ static int isdv4ParseTouchPacket(InputInfoPtr pInfo, const unsigned char *data,
channel = 1;
ds = &common->wcmChannel[channel].work;
RESET_RELATIVE(*ds);
- ds->x = touchdata.finger2.x;
- ds->y = touchdata.finger2.y;
+ ds->x = touchdata.finger2.status ? touchdata.finger2.x : lastTemp->x;
+ ds->y = touchdata.finger2.status ? touchdata.finger2.y : lastTemp->y;
ds->device_type = TOUCH_ID;
ds->device_id = TOUCH_DEVICE_ID;
ds->serial_num = 2;
--
2.8.0
Loading...