linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] Input: wacom - fix touch on newer Bamboo's
@ 2011-09-06 23:56 chris
  2011-09-09 20:41 ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: chris @ 2011-09-06 23:56 UTC (permalink / raw)
  To: linux-input, pinglinux, rydberg; +Cc: Chris Bagwell

From: Chris Bagwell <chris@cnpbagwell.com>

Bamboo's with Product ID's > 0xD4 return values unrelated to pressure
in touch 1 pressure field.  They also report touch 2's X/Y values
shifted down 1 byte (where pressure was).  This results in jumpy
1 finger touch and totally invalid 2nd finger data.

For touch detection, switch to a Touch Present single bit that
all versions of Bamboo support.

For touch 2 offset, calculate offset based on a bit that is set
different between the two packet layouts.

Since touch pressure reports were removed from driver, there was
no need to be reading pressure any more.

Signed-off-by: Chris Bagwell <chris@cnpbagwell.com>
Reviewed-by: Ping Cheng <pinglinux@gmail.com>
---

New in v2: Converted stylus_in_proximity from if() back to an && operation to
match original flow; as suggested by Ping.

 drivers/input/tablet/wacom_wac.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 2d88316..6f3bd61 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -800,20 +800,22 @@ static int wacom_bpt_touch(struct wacom_wac *wacom)
 	int i;
 
 	for (i = 0; i < 2; i++) {
-		int p = data[9 * i + 2];
-		bool touch = p && !wacom->shared->stylus_in_proximity;
+		int offset = (data[1] & 0x80) ? (8 * i) : (9 * i);
+		bool touch = data[offset + 3] & 0x80;
 
-		input_mt_slot(input, i);
-		input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
 		/*
 		 * Touch events need to be disabled while stylus is
 		 * in proximity because user's hand is resting on touchpad
 		 * and sending unwanted events.  User expects tablet buttons
 		 * to continue working though.
 		 */
+		touch = touch && wacom->shared->stylus_in_proximity;
+
+		input_mt_slot(input, i);
+		input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
 		if (touch) {
-			int x = get_unaligned_be16(&data[9 * i + 3]) & 0x7ff;
-			int y = get_unaligned_be16(&data[9 * i + 5]) & 0x7ff;
+			int x = get_unaligned_be16(&data[offset + 3]) & 0x7ff;
+			int y = get_unaligned_be16(&data[offset + 5]) & 0x7ff;
 			if (features->quirks & WACOM_QUIRK_BBTOUCH_LOWRES) {
 				x <<= 5;
 				y <<= 5;
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] Input: wacom - fix touch on newer Bamboo's
  2011-09-06 23:56 [PATCH v2] Input: wacom - fix touch on newer Bamboo's chris
@ 2011-09-09 20:41 ` Dmitry Torokhov
  2011-09-12  2:08   ` Chris Bagwell
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Torokhov @ 2011-09-09 20:41 UTC (permalink / raw)
  To: chris; +Cc: linux-input, pinglinux, rydberg

On Tue, Sep 06, 2011 at 06:56:46PM -0500, chris@cnpbagwell.com wrote:
> From: Chris Bagwell <chris@cnpbagwell.com>
> 
> Bamboo's with Product ID's > 0xD4 return values unrelated to pressure
> in touch 1 pressure field.  They also report touch 2's X/Y values
> shifted down 1 byte (where pressure was).  This results in jumpy
> 1 finger touch and totally invalid 2nd finger data.
> 
> For touch detection, switch to a Touch Present single bit that
> all versions of Bamboo support.
> 
> For touch 2 offset, calculate offset based on a bit that is set
> different between the two packet layouts.
> 
> Since touch pressure reports were removed from driver, there was
> no need to be reading pressure any more.
> 
> Signed-off-by: Chris Bagwell <chris@cnpbagwell.com>
> Reviewed-by: Ping Cheng <pinglinux@gmail.com>

Applied, thanks Chris.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] Input: wacom - fix touch on newer Bamboo's
  2011-09-09 20:41 ` Dmitry Torokhov
@ 2011-09-12  2:08   ` Chris Bagwell
  2011-09-13  5:10     ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Bagwell @ 2011-09-12  2:08 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, pinglinux, rydberg

On Fri, Sep 9, 2011 at 3:41 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Tue, Sep 06, 2011 at 06:56:46PM -0500, chris@cnpbagwell.com wrote:
>> From: Chris Bagwell <chris@cnpbagwell.com>
>>
>> Bamboo's with Product ID's > 0xD4 return values unrelated to pressure
>> in touch 1 pressure field.  They also report touch 2's X/Y values
>> shifted down 1 byte (where pressure was).  This results in jumpy
>> 1 finger touch and totally invalid 2nd finger data.
>>
>> For touch detection, switch to a Touch Present single bit that
>> all versions of Bamboo support.
>>
>> For touch 2 offset, calculate offset based on a bit that is set
>> different between the two packet layouts.
>>
>> Since touch pressure reports were removed from driver, there was
>> no need to be reading pressure any more.
>>
>> Signed-off-by: Chris Bagwell <chris@cnpbagwell.com>
>> Reviewed-by: Ping Cheng <pinglinux@gmail.com>
>
> Applied, thanks Chris.
>

I'm sorry, Dmitry, but I messed up this version #2 of patch.  Can you
please revert or hand fix?

+               touch = touch && wacom->shared->stylus_in_proximity;

Somewhere along the line, I lost a "!" on that stylus_in_proximity
check.  So this v2 patch breaks touch support.

If you revert, I am planning on submitting 2 or 3 new wacom clean up
patches in next week.  I can resend with that batch.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] Input: wacom - fix touch on newer Bamboo's
  2011-09-12  2:08   ` Chris Bagwell
@ 2011-09-13  5:10     ` Dmitry Torokhov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2011-09-13  5:10 UTC (permalink / raw)
  To: Chris Bagwell; +Cc: linux-input, pinglinux, rydberg

On Sun, Sep 11, 2011 at 09:08:51PM -0500, Chris Bagwell wrote:
> On Fri, Sep 9, 2011 at 3:41 PM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> > On Tue, Sep 06, 2011 at 06:56:46PM -0500, chris@cnpbagwell.com wrote:
> >> From: Chris Bagwell <chris@cnpbagwell.com>
> >>
> >> Bamboo's with Product ID's > 0xD4 return values unrelated to pressure
> >> in touch 1 pressure field.  They also report touch 2's X/Y values
> >> shifted down 1 byte (where pressure was).  This results in jumpy
> >> 1 finger touch and totally invalid 2nd finger data.
> >>
> >> For touch detection, switch to a Touch Present single bit that
> >> all versions of Bamboo support.
> >>
> >> For touch 2 offset, calculate offset based on a bit that is set
> >> different between the two packet layouts.
> >>
> >> Since touch pressure reports were removed from driver, there was
> >> no need to be reading pressure any more.
> >>
> >> Signed-off-by: Chris Bagwell <chris@cnpbagwell.com>
> >> Reviewed-by: Ping Cheng <pinglinux@gmail.com>
> >
> > Applied, thanks Chris.
> >
> 
> I'm sorry, Dmitry, but I messed up this version #2 of patch.  Can you
> please revert or hand fix?
> 
> +               touch = touch && wacom->shared->stylus_in_proximity;
> 
> Somewhere along the line, I lost a "!" on that stylus_in_proximity
> check.  So this v2 patch breaks touch support.
> 
> If you revert, I am planning on submitting 2 or 3 new wacom clean up
> patches in next week.  I can resend with that batch.

I just fixed it up locally, no need to resend.

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-09-13  5:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-06 23:56 [PATCH v2] Input: wacom - fix touch on newer Bamboo's chris
2011-09-09 20:41 ` Dmitry Torokhov
2011-09-12  2:08   ` Chris Bagwell
2011-09-13  5:10     ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).