Hi! I've never submitted a patch to anything before so I hope I'm not
wasting your time, but I found a bug while using my cintiq companion hybrid
and I traced it to linux_wacom.
I'm on Ubuntu 14.04, and the device I'm testing with is a Cintiq Companion
Hybrid.
The bug I noticed is that sometimes (maybe one time in 100), when I try to
switch from eraser to pen tip or back, the device would be misdetected.
After some tracing through the code, I note that it's possible for a device
with an invalid/unknown ID to set the proximity to 'In' in a range event.
When this happens, xinput query-state on the device will show 'In', even
when it is out of range. If this state is on the eraser, and then you place
the pen tip in range, then xinput shows both devices as 'In', but
applications detect the wrong one (the eraser in this case).
It's a simple fix: After the ID is potentially set in wacom_intuos_inout, I
check to see if the ID is valid, and if not I return 0 before the range or
exit events can be executed. I've included a patch below that does exactly
that. I've tested on the 3.7 tree, but I believe all of the different trees
should compile with this patch. I have been unable to cause the bug to
occur after applying the patch even after several hours of use.
Please let me know if I'm doing anything wrong in the submission of this
patch, because I'd like to know 'the right way' in the future.
Thanks!
- Robert Miller
------------------------------------------------------------------
>From 1ab1b2884abb75690b653a7f8961d8dfebd87d09 Mon Sep 17 00:00:00 2001
From: Robert Miller <yocto...@gmail.com>
Date: Fri, 14 Nov 2014 01:01:18 -0800
Subject: [PATCH] Prevent occasional Pen/Eraser misdetection
I note that it's possible for a device with an invalid/unknown ID
to set the proximity to 'In' in a range event.
It's a simple fix: After the ID is potentially set in
wacom_intuos_inout, I check to see if the ID is valid, and
if not I return 0 before the range or exit events can be executed.
---
3.7/wacom_wac.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/3.7/wacom_wac.c b/3.7/wacom_wac.c
index 6caf6e6..db05815 100644
--- a/3.7/wacom_wac.c
+++ b/3.7/wacom_wac.c
@@ -477,6 +477,13 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
}
return 1;
}
+
+ /*
+ * If we don't know the ID at this point,
+ * then there's not much we can do with the event.
+ */
+ if(!wacom->id[idx])
+ return 0;
/* older I4 styli don't work with new Cintiqs */
if (!((wacom->id[idx] >> 20) & 0x01) &&
--
1.9.1
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel