All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] HID: wacom: Override incorrect logical maximum contact identifier
@ 2017-04-19 21:47 Jason Gerecke
  2017-04-20  9:33 ` Jiri Kosina
  0 siblings, 1 reply; 2+ messages in thread
From: Jason Gerecke @ 2017-04-19 21:47 UTC (permalink / raw)
  To: linux-input
  Cc: Jiri Kosina, Benjamin Tissoires, Ping Cheng, Aaron Skomra,
	Jason Gerecke, Jason Gerecke

It apears that devices designed around Wacom's G11 chipset (e.g. Lenovo
ThinkPad Yoga 260, Lenovo ThinkPad X1 Yoga, Dell XPS 12 9250, Dell Venue
8 Pro 5855, etc.) suffer from a common issue in their HID descriptors.
The logical maximum is not updated for the "Contact Identifier" usage,
leaving it as just "1" despite these devices being capable of tracking
far more touches.

Commit 60a221869803 began ignoring usages with out-of-range values,
causing problems for devices based on this chipset. Touches after
the first will have an out-of-range Contact Identifier, and ignoring
that usage will cause the kernel to incorrectly slot each finger's
events (along with all the knock-on userspace effects that entails).

This commit checks for these buggy descriptors and updates the maximum
where required. Prior chipsets have used "255" as the maximum (and the
G11, at least, doesn't seem to actually use IDs outside the range of
1..CONTACTMAX) so continue using this value.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
---
Jiri, please add this to your 'for-4.11/upstream-fixes' branch since
commit 60a221869803 was introduced in 4.11 and leaving this unaddressed
could impact a wide variety of tablet PCs.

 drivers/hid/wacom_wac.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 603f7fcd8df6..c68ac65db7ff 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -2176,6 +2176,16 @@ static void wacom_wac_finger_usage_mapping(struct hid_device *hdev,
 		wacom_wac->hid_data.cc_index = field->index;
 		wacom_wac->hid_data.cc_value_index = usage->usage_index;
 		break;
+	case HID_DG_CONTACTID:
+		if ((field->logical_maximum - field->logical_minimum) < touch_max) {
+			/*
+			 * The HID descriptor for G11 sensors leaves logical
+			 * maximum set to '1' despite it being a multitouch
+			 * device. Override to a sensible number.
+			 */
+			field->logical_maximum = 255;
+		}
+		break;
 	}
 }
 
-- 
2.12.2


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

* Re: [PATCH] HID: wacom: Override incorrect logical maximum contact identifier
  2017-04-19 21:47 [PATCH] HID: wacom: Override incorrect logical maximum contact identifier Jason Gerecke
@ 2017-04-20  9:33 ` Jiri Kosina
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2017-04-20  9:33 UTC (permalink / raw)
  To: Jason Gerecke
  Cc: linux-input, Benjamin Tissoires, Ping Cheng, Aaron Skomra, Jason Gerecke

On Wed, 19 Apr 2017, Jason Gerecke wrote:

> It apears that devices designed around Wacom's G11 chipset (e.g. Lenovo
> ThinkPad Yoga 260, Lenovo ThinkPad X1 Yoga, Dell XPS 12 9250, Dell Venue
> 8 Pro 5855, etc.) suffer from a common issue in their HID descriptors.
> The logical maximum is not updated for the "Contact Identifier" usage,
> leaving it as just "1" despite these devices being capable of tracking
> far more touches.
> 
> Commit 60a221869803 began ignoring usages with out-of-range values,
> causing problems for devices based on this chipset. Touches after
> the first will have an out-of-range Contact Identifier, and ignoring
> that usage will cause the kernel to incorrectly slot each finger's
> events (along with all the knock-on userspace effects that entails).
> 
> This commit checks for these buggy descriptors and updates the maximum
> where required. Prior chipsets have used "255" as the maximum (and the
> G11, at least, doesn't seem to actually use IDs outside the range of
> 1..CONTACTMAX) so continue using this value.
> 
> Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
> ---
> Jiri, please add this to your 'for-4.11/upstream-fixes' branch since
> commit 60a221869803 was introduced in 4.11 and leaving this unaddressed
> could impact a wide variety of tablet PCs.

60a221869803 has actually been present since 4.10-rc1, therefore I've 
added

	Cc: stable@vger.kernel.org
	Fixes: 60a221869803 ("HID: wacom: generic: add support for touchring")

to make sure all the affected stables will eventually get it.

-- 
Jiri Kosina
SUSE Labs


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

end of thread, other threads:[~2017-04-20  9:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-19 21:47 [PATCH] HID: wacom: Override incorrect logical maximum contact identifier Jason Gerecke
2017-04-20  9:33 ` Jiri Kosina

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.