[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#677164: wacom: Try to fix regressions in 3.2.18-1



Hi Ben,

The attached changes are extracted from the commit at the tip of

  git://linuxwacom.git.sourceforge.net/gitroot/linuxwacom/input-wacom

According to upstream, Thinkpad x220t (0xE6) hardware reports too high
a maximum number of touch points.  The second of the patches below
makes the driver prefer the hardcoded touch_max value when present.
This modifies the change introduced by

  f393ee2b814e Input: wacom - retrieve maximum number of touch points

Both Ping and Chris seemed to consider it the right thing to do, at
least when testing.  I have not seen test results without it applied.

The third and fourth patches concern changes introduced by

  1963518b9b1b Input: wacom - add 0xE5 (MT device) support

Patch 3 is definitely needed if applying that patch; patch 4 I'm less
convinced about.  I'm including them here for reference but don't
think we need them yet.

I think Nils has tested Linus's master + patch 1 + patch 2 + patch 3
and found it to work ok on his laptop.  (But keep in mind that the
0xE5 support patch touched code for some other devices, too, so I am
happiest keeping it backed out for now.)

The upshot: sid might need patch 2.

It's hard to say anything since everything seems to be up in the air.
Hopefully something like these patches will be in linux-next soon to
makes matters a little clearer (in particular, with patch descriptions
I didn't make up).

Ping Cheng (4):
  wacom: do not crash when retrieving touch_max
  wacom: leave touch_max as is if predefined
  wacom: do not request tablet data on MT Tablet PC pen interface
  wacom: ignore new-style Wacom multi touch packets on MT Tablet PC

 drivers/input/tablet/wacom_sys.c | 7 +++++--
 drivers/input/tablet/wacom_wac.c | 6 +++++-
 2 files changed, 10 insertions(+), 3 deletions(-)

Hope that helps,
Jonathan
From: Ping Cheng <pinglinux@gmail.com>
Date: Sun, 24 Jun 2012 09:48:03 -0500
Subject: wacom: do not crash when retrieving touch_max

When rep_data was an array

	unsigned char rep_data[2];

spelling its address as &rep_data was perfectly valid, but now that
it is dynamically allocated

	unsigned char *rep_data = kmalloc(2, GFP_KERNEL);

that expression returns a pointer to the pointer rather than to the
array itself.  Regression introduced by commit f393ee2b814e (Input:
wacom - retrieve maximum number of touch points, 2012-04-29).

[jn: from mailing list discussion, with new description.
 This change is also available as part of a larger commit in the
 input-wacom repository.]

Signed-off-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 drivers/input/tablet/wacom_sys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index cad5602d3ce4..6b1cd71ba320 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -216,7 +216,7 @@ static void wacom_retrieve_report_data(struct usb_interface *intf,
 
 		rep_data[0] = 12;
 		result = wacom_get_report(intf, WAC_HID_FEATURE_REPORT,
-					  rep_data[0], &rep_data, 2,
+					  rep_data[0], rep_data, 2,
 					  WAC_MSG_RETRIES);
 
 		if (result >= 0 && rep_data[1] > 2)
-- 
1.7.11.rc3

From: Ping Cheng <pinglinux@gmail.com>
Date: Sun, 24 Jun 2012 23:00:29 -0500
Subject: wacom: leave touch_max as is if predefined

Another fixup to f393ee2b814e (Input: wacom - retrieve maximum number
of touch points, 2012-04-29).  The 0xE6 tablet in the Thinkpad x220t
reports the wrong value for MAXCONTACTS so the hardcoded value must
take precedence.

[jn: extracted from a larger commit in the input-wacom repository,
 with new description]

Signed-off-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 drivers/input/tablet/wacom_sys.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 6b1cd71ba320..8b31473a81fe 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -401,7 +401,9 @@ static int wacom_parse_hid(struct usb_interface *intf,
 				break;
 
 			case HID_USAGE_CONTACTMAX:
-				wacom_retrieve_report_data(intf, features);
+				/* leave touch_max as is if predefined */
+				if (!features->touch_max)
+					wacom_retrieve_report_data(intf, features);
 				i++;
 				break;
 			}
-- 
1.7.11.rc3

From: Ping Cheng <pinglinux@gmail.com>
Date: Sun, 24 Jun 2012 23:29:29 -0500
Subject: wacom: do not request tablet data on MT Tablet PC pen interface

When in commit 1963518b9b1b (Input: wacom - add 0xE5 (MT device)
support, 2012-04-29) the driver stopped asking for multitouch tablet
data on the pen interface of a tablet PC, as a side effect we started
executing the "else" to that if statement.  Oops.

This is needed for the 0xE6 tablet in the Thinkpad x220t to be usable
again.  Meanwhile the 0xE3 works fine without this.  Not sure why. -jn

[jn: extracted from a larger commit in the input-wacom repository,
 with new description]

Signed-off-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 drivers/input/tablet/wacom_sys.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 8b31473a81fe..19e4725858dd 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -467,6 +467,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
 		}
 	} else if (features->type != TABLETPC &&
 		   features->type != WIRELESS &&
+		   features->type != TABLETPC2FG &&
 		   features->device_type == BTN_TOOL_PEN) {
 		do {
 			rep_data[0] = 2;
-- 
1.7.11.rc3

From: Ping Cheng <pinglinux@gmail.com>
Date: Sun, 24 Jun 2012 23:44:46 -0500
Subject: wacom: ignore new-style Wacom multi touch packets on MT Tablet PC

Tablets such as 0xE6 (Thinkpad x220t) already worked fine before
adding support for the new packet format, so let's drop the
functionality for such devices for now.  Meanwhile 0xE5 can still use
the new packet format.

This should bring the behavior of TABLETPC2FG devices closer to that
from before 1963518b9b1b (Input: wacom - add 0xE5 (MT device) support,
2012-04-29).

[jn: extracted from a larger commit in the input-wacom repository,
 with new description]

Signed-off-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 drivers/input/tablet/wacom_wac.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 004bc1bb1544..d696ab7ecc2b 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -1547,7 +1547,6 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
 		__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
 		break;
 
-	case TABLETPC2FG:
 	case MTSCREEN:
 		if (features->device_type == BTN_TOOL_FINGER) {
 
@@ -1559,6 +1558,11 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
 
 			for (i = 0; i < features->touch_max; i++)
 				wacom_wac->slots[i] = -1;
+		}
+		/* fall through */
+
+	case TABLETPC2FG:
+		if (features->device_type == BTN_TOOL_FINGER) {
 
 			input_mt_init_slots(input_dev, features->touch_max);
 			input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE,
-- 
1.7.11.rc3


Reply to: