When a tool enters proximity, the usbChooseChannel function zeros
out one of the WacomDeviceState structures in the common->wcmChannel
array and returns its index. That state is then initalized using
the input events recieved from the kernel, and is assumed to be
a complete description by the time it is handed off to the wcmEvent
function.

The kernel's duplicate event filtering can cause problems for this,
however. If the value of the axis as it enters prox is identical to
its value when it left prox, the kernel will not send an event for
it (leaving the associated WacomDeviceState field zero). If this
occurs with the X and/or Y axis, the pointer will jump to the wrong
screen location.

To prevent the pointer from jumping around, we check if the X or Y
value of the WacomDeviceState are still zero after reading through
an enter-prox packet. If either is, we request its current value
from the kernel just in case it was filtered out. Other axes may be
affected by this bug, but should not cause as many problems.

Signed-off-by: Jason Gerecke <killert...@gmail.com>
---
 src/wcmUSB.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index 5332702..9ececf3 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -1782,6 +1782,28 @@ static void usbDispatchEvents(InputInfoPtr pInfo)
                return;
        }
 
+       /* verify we have minimal data when entering prox */
+       if (ds->proximity && !dslast.proximity) {
+               struct input_absinfo absinfo;
+
+               if (!ds->x && !IsPad(priv)) {
+                       if (ioctl(priv->pInfo->fd, EVIOCGABS(ABS_X), &absinfo) 
< 0)
+                       {
+                               DBG(-1, common, "unable to ioctl current x 
value.\n");
+                               return;
+                       }
+                       ds->x = absinfo.value;
+               }
+               if (!ds->y && !IsPad(priv)) {
+                       if (ioctl(priv->pInfo->fd, EVIOCGABS(ABS_Y), &absinfo) 
< 0)
+                       {
+                               DBG(-1, common, "unable to ioctl current x 
value.\n");
+                               return;
+                       }
+                       ds->y = absinfo.value;
+               }
+       }
+
        /*reset the serial number when the tool is going out */
        if (!ds->proximity)
                private->wcmLastToolSerial = 0;
-- 
2.1.0


------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to