linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: input: force generic axis to be mapped to their user space axis
@ 2014-08-25 17:07 Benjamin Tissoires
  2014-08-26  7:25 ` Jiri Kosina
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Tissoires @ 2014-08-25 17:07 UTC (permalink / raw)
  To: Jiri Kosina, Éric Brunet; +Cc: linux-input, linux-kernel

Atmel 840B digitizer presents a stylus interface which reports twice
the X coordinate and then twice the Y coordinate. In its current
implementation, hid-input assign the first X to X, then the second to Y,
then the first Y to Z, then the second one to RX.

This is wrong, and X should always be mapped to X, no matter what.
A solution consists in forcing X, Y, Z, RX, RY, RZ to be mapped to their
correct user space counter part.

Reported-by: Éric Brunet <Eric.Brunet@lps.ens.fr>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---

Hi Jiri,

well, this fix should have been in the Linux kernel for ages IMO. This would
have prevented the need of HID_QUIRK_MULTI_INPUT for the very first multitouch
panels. I can not see any reasons why we want to have the second X mapped to
Y, and in the device reported here, both X have the same value.

Note that I am still investigating the spurious jumps reported by Eric, but we
should be safe in taking this one to master.

Cheers,
Benjamin

 drivers/hid/hid-input.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 2619f7f..2df7fdd 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -599,6 +599,12 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
 		/* These usage IDs map directly to the usage codes. */
 		case HID_GD_X: case HID_GD_Y: case HID_GD_Z:
 		case HID_GD_RX: case HID_GD_RY: case HID_GD_RZ:
+			if (field->flags & HID_MAIN_ITEM_RELATIVE)
+				map_rel(usage->hid & 0xf);
+			else
+				map_abs_clear(usage->hid & 0xf);
+			break;
+
 		case HID_GD_SLIDER: case HID_GD_DIAL: case HID_GD_WHEEL:
 			if (field->flags & HID_MAIN_ITEM_RELATIVE)
 				map_rel(usage->hid & 0xf);
-- 
2.1.0

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

* Re: [PATCH] HID: input: force generic axis to be mapped to their user space axis
  2014-08-25 17:07 [PATCH] HID: input: force generic axis to be mapped to their user space axis Benjamin Tissoires
@ 2014-08-26  7:25 ` Jiri Kosina
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2014-08-26  7:25 UTC (permalink / raw)
  To: Benjamin Tissoires; +Cc: Éric Brunet, linux-input, linux-kernel

On Mon, 25 Aug 2014, Benjamin Tissoires wrote:

> Atmel 840B digitizer presents a stylus interface which reports twice
> the X coordinate and then twice the Y coordinate. In its current
> implementation, hid-input assign the first X to X, then the second to Y,
> then the first Y to Z, then the second one to RX.
> 
> This is wrong, and X should always be mapped to X, no matter what.
> A solution consists in forcing X, Y, Z, RX, RY, RZ to be mapped to their
> correct user space counter part.
> 
> Reported-by: Éric Brunet <Eric.Brunet@lps.ens.fr>
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Applied, thanks.

-- 
Jiri Kosina
SUSE Labs
--
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] 2+ messages in thread

end of thread, other threads:[~2014-08-26  7:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-25 17:07 [PATCH] HID: input: force generic axis to be mapped to their user space axis Benjamin Tissoires
2014-08-26  7:25 ` Jiri Kosina

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).