On Mon, Nov 14, 2011 at 4:28 PM, Jason Gerecke <killert...@gmail.com> wrote:
> On Mon, Nov 14, 2011 at 3:08 PM, Chris Bagwell <ch...@cnpbagwell.com> wrote:
>> On Mon, Nov 14, 2011 at 4:40 PM, Chris Bagwell <ch...@cnpbagwell.com> wrote:
>>> On Mon, Nov 14, 2011 at 3:48 PM, Jason Gerecke <killert...@gmail.com> wrote:
>>>> On Sun, Jun 26, 2011 at 5:44 PM, Peter Hutterer
>>>> <peter.hutte...@who-t.net> wrote:
>>>>> On Sun, Jun 26, 2011 at 07:40:35PM -0500, Chris Bagwell wrote:
>>>>>> On Sun, Jun 26, 2011 at 7:31 PM, Peter Hutterer
>>>>>> <peter.hutte...@who-t.net> wrote:
>>>>>> > On Sat, Jun 25, 2011 at 01:05:52PM -0500, ch...@cnpbagwell.com wrote:
>>>>>> >> From: Chris Bagwell <ch...@cnpbagwell.com>
>>>>>> >>
>>>>>> >> We really need to add hooks to query pre-existing device state when
>>>>>> >> input driver starts up because slot ID is almost never sent when
>>>>>> >> touching 1 finger to screen.
>>>>>> >>
>>>>>> >> In mean time, it makes sense to default device_type to most likely
>>>>>> >> value of TOUCH (the T in MT) for this function used only by MT
>>>>>> >> devices.
>>>>>> >>
>>>>>> >> The default of zero is causing some events to be filtered mistakenly.
>>>>>> >>
>>>>>> >> Signed-off-by: Chris Bagwell <ch...@cnpbagwell.com>
>>>>>> >
>>>>>> > Merged 1/4 and this one for now, see my comments to 2/4 for the rest.
>>>>>> >
>>>>>> > Cheers,
>>>>>> >  Peter
>>>>>>
>>>>>> Can you verify you meant 2/4 and 4/4 were merged?  2/4 is the simple
>>>>>> debug statement.
>>>>>
>>>>> yes, sorry. I meant 2 and 4 were merged. They arrived out-of-order in my
>>>>> inbox so I got the numbers mixed up.
>>>>>
>>>>> Cheers,
>>>>>  Peter
>>>>>
>>>>
>>>> I was finishing my final round of testing in preparation for 0.12.0
>>>> when I noticed this commit caused the pen and touch tools on my MT USB
>>>> ISDv4 tablet PC to quit working. At first I thought it might be
>>>> because setting device_type before the loop causes it to never
>>>> execute, but fixing that still results in the pen having issues (touch
>>>> starts working again though).
>>>>
>>>> Chris, can you remember any details about the device filtering
>>>> problems this patch was fixing? I'm considering reverting this patch
>>>> for 0.12 but would like to have a little more information before doing
>>>> that.
>>>>
>>>
>>> Reverting it would break Bamboo's and generic MT touchscreens.  The
>>> basic issue is easy to reproduce on touch only devices.
>>>
>>> Are you using an upstream kernel driver for MT ISDv4?  Is this a comb
>>> pen+touch on same USB interface (hid-wacom)? I might be able to give
>>> some suggestions if I know how device is sending events.
>>>
>>> The MT Slot ID has to start at something and that something is zero.
>>> Majority of time your going to use 1 finger on screen which maps to
>>> Slot ID of zero and so you can assume it will be rare to see a Slot ID
>>> received inside xf86-input-wacom.
>>>
>>> The current code works around that by always assuming MT devices are
>>> most likely touch devices.  If its a combo MT+pen device and that pen
>>> doesn't send Slot ID's then I can see how that would break things.
>>>
>>> For Bamboo MT devices and generic MT touchscreens (without combined
>>> Pen on same device), it will work fine to move this logic out of
>>> normal event loop and do it once during init phase.
>>>
>>> Would that change have side affect to fixing your issue?
>>>
>>
>> Looking at the usbInitTool function closer, it looks like there was a
>> basic issue that needs to be fixed for MT+pen that even reverting the
>> patch won't fix.  It required a BTN_TOOL_* or ABS_MT_ every sync
>> window or we'd get hard coded invalid ID of zero... and filtering
>> makes those events rare.
>>
>> We should pass in the previous device_type and if no new type is
>> found, return the previous value... Except in the special case were
>> the previous value was zero.  Then we can default to TOUCH_ID.
>>
>> Since BTN_TOOL_PEN doesn't have the same zero value issue as
>> ABS_MT_SLOT_ID, I think its safe to default to TOUCH_ID.
>>
>> Chris
>>
>
> Saw this come through after sending the last one... Making a patch to
> do this is a definite improvement, though things still aren't quite
> right. It seems that any touch to the screen while the pen is in
> proximity will disable both pen and touch until the pen leaves
> proximity. It does sound like this plan *should* work though, so I'll
> continue poking around.
>
> Jason
>
> ---
> Day xee-nee-svsh duu-'ushtlh-ts'it;
> nuu-wee-ya' duu-xan' 'vm-nvshtlh-ts'it.
> Huu-chan xuu naa~-gha.
>

Nevermind. I was using the wrong variable for the last event type. The
attached patches seem to fix the problems with my device. I'd be glad
if you could look them over and if possible give them a quick test.

Jason

---
Day xee-nee-svsh duu-'ushtlh-ts'it;
nuu-wee-ya' duu-xan' 'vm-nvshtlh-ts'it.
Huu-chan xuu naa~-gha.
From ba6444e86489737a51b110dc53bcb35e629c4776 Mon Sep 17 00:00:00 2001
From: Jason Gerecke <killert...@gmail.com>
Date: Mon, 14 Nov 2011 13:04:24 -0800
Subject: [PATCH 1/2] Fix usbInitToolType to not always return TOUCH_ID

Commit ca922994 changed usbInitToolType to use the tool
TOUCH_ID by default. Because of the way the 'for' loop just
below is handled though, the function would never return
anything but TOUCH_ID. This patch changes things to only
return TOUCH_ID if no data for an alternate tool type
could be found in the event packets.

Signed-off-by: Jason Gerecke <killert...@gmail.com>
---
 src/wcmUSB.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index 14de990..4d05f67 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -1346,11 +1346,11 @@ static int usbParseBTNEvent(WacomCommonPtr common,
  * events to be processed.
  * @param nevents Number of events in the packet.
  *
- * @return The tool type. 0 if no pen/touch/eraser event code in the event.
+ * @return The tool type. TOUCH_ID if no pen/touch/eraser event code in the event.
  */
 static int usbInitToolType(const struct input_event *event_ptr, int nevents)
 {
-	int i, device_type = TOUCH_ID;
+	int i, device_type = 0;
 	struct input_event* event = (struct input_event *)event_ptr;
 
 	for (i = 0; (i < nevents) && !device_type; ++i)
@@ -1378,6 +1378,11 @@ static int usbInitToolType(const struct input_event *event_ptr, int nevents)
 		event++;
 	}
 
+	if (!device_type)
+	{
+		device_type = TOUCH_ID;
+	}
+
 	return device_type;
 }
 
-- 
1.7.4.1

From 74b188a9ede8f5f6a33e9bb5cc782175b3a90c1f Mon Sep 17 00:00:00 2001
From: Jason Gerecke <killert...@gmail.com>
Date: Mon, 14 Nov 2011 16:52:35 -0800
Subject: [PATCH 2/2] Have usbInitToolType return the old tool type if available

If the tool was not specified within an event packet, the
usbInitToolType function would return TOUCH_ID. This caused
problems for combined pen+touch devices when the pen was in
range, since only the first packet (which explicitely specified
the STYLUS tool) would not be filtered as "single touch"
data.

This patch passes along the old tool type, so that if no
tool is found in the current packet, the old tool type may
be adopted.

Signed-off-by: Jason Gerecke <killert...@gmail.com>
---
 src/wcmUSB.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index 4d05f67..755c410 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -1345,10 +1345,12 @@ static int usbParseBTNEvent(WacomCommonPtr common,
  * @param event_ptr A pointer to the USB data packet that contains the
  * events to be processed.
  * @param nevents Number of events in the packet.
+ * @param last_device_type The device type for the last event
  *
- * @return The tool type. TOUCH_ID if no pen/touch/eraser event code in the event.
+ * @return The tool type. last_device_type if no pen/touch/eraser event code
+ *         in the event, or TOUCH_ID if last_device_type is not a tool.
  */
-static int usbInitToolType(const struct input_event *event_ptr, int nevents)
+static int usbInitToolType(const struct input_event *event_ptr, int nevents, int last_device_type)
 {
 	int i, device_type = 0;
 	struct input_event* event = (struct input_event *)event_ptr;
@@ -1380,7 +1382,10 @@ static int usbInitToolType(const struct input_event *event_ptr, int nevents)
 
 	if (!device_type)
 	{
-		device_type = TOUCH_ID;
+		if (last_device_type)
+			device_type = last_device_type;
+		else
+			device_type = TOUCH_ID;
 	}
 
 	return device_type;
@@ -1417,7 +1422,8 @@ static void usbDispatchEvents(InputInfoPtr pInfo)
 
 	if (private->wcmUseMT)
 		private->wcmDeviceType = usbInitToolType(private->wcmEvents,
-							 private->wcmEventCnt);
+							 private->wcmEventCnt,
+							 dslast.device_type);
 
 	if (private->wcmPenTouch)
 	{
-- 
1.7.4.1

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to