Linux Input/HID development
 help / color / mirror / Atom feed
From: Orivej Desh <orivej@gmx.fr>
To: linux-input@vger.kernel.org
Subject: Missing axis on Gembird JPD-DUALFORCE2 since Linux 3.18
Date: Mon, 10 Aug 2015 08:26:42 +0000	[thread overview]
Message-ID: <20150810082642.3a0880ab@orivej.orivej.org> (raw)

I have one of those gamepads, and since Linux 3.18 the kernel hides one
of its axes.

In Linux 3.17 jstest reports it as

     Joystick (PC Game Controller       ) has 7 axes (X, Y, Z, Rx, Rz, Hat0X, Hat0Y)

and in Linux 3.18 as

     Joystick (PC Game Controller       ) has 6 axes (X, Y, Z, Rz, Hat0X, Hat0Y)

It has 6 physical axes (X, Y, Rx, Ry, Hat0X, Hat0Y), but Ry is reported
as Rz, and Z emits noise (which had to be silenced with jscal).

I bisected disappearing axis to the following commit [1], but if I
understand correctly, it is the device that is wrong by misreporting
some property of Rx.

I can remap Rz to Ry in userspace with ioctl(fd, JSIOCSAXMAP, ...),
though I never had to.  Can I likewise restore Rx in userspace (and also
delete Z)?  If not, or if this device justifies a quirk, how should it
be added?

usb-devices report: [2].

[1]
commit 79346d620e9de87912de73337f6df8b7f9a46888
Author: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Date:   Mon Aug 25 13:07:10 2014 -0400

    HID: input: force generic axis to be mapped to their user space axis

    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>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>

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]
T:  Bus=09 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  2 Spd=1.5 MxCh= 0
D:  Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=11ff ProdID=3331 Rev=01.07
S:  Product=PC Game Controller
C:  #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=03(HID  ) Sub=00 Prot=00 Driver=usbhid


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

             reply	other threads:[~2015-08-10  8:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-10  8:26 Orivej Desh [this message]
2015-08-10 14:27 ` Missing axis on Gembird JPD-DUALFORCE2 since Linux 3.18 Benjamin Tissoires
2015-08-10 21:36   ` Orivej Desh
2015-08-10 21:53     ` Benjamin Tissoires
2015-08-10 22:28       ` Orivej Desh
2015-08-11 15:35         ` Benjamin Tissoires

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150810082642.3a0880ab@orivej.orivej.org \
    --to=orivej@gmx.fr \
    --cc=linux-input@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox