Linux Input/HID development
 help / color / mirror / Atom feed
* Missing axis on Gembird JPD-DUALFORCE2 since Linux 3.18
@ 2015-08-10  8:26 Orivej Desh
  2015-08-10 14:27 ` Benjamin Tissoires
  0 siblings, 1 reply; 6+ messages in thread
From: Orivej Desh @ 2015-08-10  8:26 UTC (permalink / raw)
  To: linux-input

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

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

* Re: Missing axis on Gembird JPD-DUALFORCE2 since Linux 3.18
  2015-08-10  8:26 Missing axis on Gembird JPD-DUALFORCE2 since Linux 3.18 Orivej Desh
@ 2015-08-10 14:27 ` Benjamin Tissoires
  2015-08-10 21:36   ` Orivej Desh
  0 siblings, 1 reply; 6+ messages in thread
From: Benjamin Tissoires @ 2015-08-10 14:27 UTC (permalink / raw)
  To: Orivej Desh; +Cc: linux-input

Hi,

On Mon, Aug 10, 2015 at 4:26 AM, Orivej Desh <orivej@gmx.fr> wrote:
> 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.

Thanks for the bisect. Could you please run a hid-recorder from
http://bentiss.github.io/hid-replay-docs/ and record a few events from
your joypad? Depending on the output, we will be able to tell you
where this should be fixed (but I strongly suspect that the kernel
should be fixed).

Cheers,
Benjamin

>
> 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
--
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] 6+ messages in thread

* Re: Missing axis on Gembird JPD-DUALFORCE2 since Linux 3.18
  2015-08-10 14:27 ` Benjamin Tissoires
@ 2015-08-10 21:36   ` Orivej Desh
  2015-08-10 21:53     ` Benjamin Tissoires
  0 siblings, 1 reply; 6+ messages in thread
From: Orivej Desh @ 2015-08-10 21:36 UTC (permalink / raw)
  To: Benjamin Tissoires; +Cc: linux-input

[-- Attachment #1: Type: text/plain, Size: 3785 bytes --]

* Benjamin Tissoires
> Thanks for the bisect. Could you please run a hid-recorder from
> http://bentiss.github.io/hid-replay-docs/ and record a few events from
> your joypad? Depending on the output, we will be able to tell you
> where this should be fixed (but I strongly suspect that the kernel
> should be fixed).

See attached idle.hid, with what appears to be noise on the Z axis when
the joypad is idle, and XYRxRy.hid with my approximation to the sequence
of physical X Y Rx Ry zero-negative-positive-zero swings.

> On Mon, Aug 10, 2015 at 4:26 AM, Orivej Desh <orivej@gmx.fr> wrote:
> > 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

[-- Attachment #2: XYRxRy.hid.gz --]
[-- Type: application/gzip, Size: 7895 bytes --]

[-- Attachment #3: idle.hid.gz --]
[-- Type: application/gzip, Size: 11268 bytes --]

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

* Re: Missing axis on Gembird JPD-DUALFORCE2 since Linux 3.18
  2015-08-10 21:36   ` Orivej Desh
@ 2015-08-10 21:53     ` Benjamin Tissoires
  2015-08-10 22:28       ` Orivej Desh
  0 siblings, 1 reply; 6+ messages in thread
From: Benjamin Tissoires @ 2015-08-10 21:53 UTC (permalink / raw)
  To: Orivej Desh; +Cc: linux-input

On Mon, Aug 10, 2015 at 5:36 PM, Orivej Desh <orivej@gmx.fr> wrote:
> * Benjamin Tissoires
>> Thanks for the bisect. Could you please run a hid-recorder from
>> http://bentiss.github.io/hid-replay-docs/ and record a few events from
>> your joypad? Depending on the output, we will be able to tell you
>> where this should be fixed (but I strongly suspect that the kernel
>> should be fixed).
>
> See attached idle.hid, with what appears to be noise on the Z axis when
> the joypad is idle, and XYRxRy.hid with my approximation to the sequence
> of physical X Y Rx Ry zero-negative-positive-zero swings.

Thanks for the logs.

So, yes, it appears that your joypad as a weird report descriptor.
It declares 2 Z axis, no Ry and one Rz.

The first Z axis seems somewhat correlated to X, but does not seem to
add any actual value but noise.

If I understand correctly your problem, I can submit a patch which
will mute the Z axis, and provide proper Rx,Ry so you won't have to
deal with that in userspace.
Will this be OK with you?

Cheers,
Benjamin

>
>> On Mon, Aug 10, 2015 at 4:26 AM, Orivej Desh <orivej@gmx.fr> wrote:
>> > 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

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

* Re: Missing axis on Gembird JPD-DUALFORCE2 since Linux 3.18
  2015-08-10 21:53     ` Benjamin Tissoires
@ 2015-08-10 22:28       ` Orivej Desh
  2015-08-11 15:35         ` Benjamin Tissoires
  0 siblings, 1 reply; 6+ messages in thread
From: Orivej Desh @ 2015-08-10 22:28 UTC (permalink / raw)
  To: Benjamin Tissoires; +Cc: linux-input

* Benjamin Tissoires
> Thanks for the logs.
> 
> So, yes, it appears that your joypad as a weird report descriptor.
> It declares 2 Z axis, no Ry and one Rz.
>
> The first Z axis seems somewhat correlated to X, but does not seem to
> add any actual value but noise.

That's right.

> If I understand correctly your problem, I can submit a patch which
> will mute the Z axis, and provide proper Rx,Ry so you won't have to
> deal with that in userspace.
> Will this be OK with you?

I would appreciate it if you do this, and learn to do it myself!  Yet I
think that Z axis is better removed than muted; it serves no purpose and
would only confuse other users of this device (if any) when tools
present them with 7 axes to configure.

> On Mon, Aug 10, 2015 at 5:36 PM, Orivej Desh <orivej@gmx.fr> wrote:
> > * Benjamin Tissoires
> >> Thanks for the bisect. Could you please run a hid-recorder from
> >> http://bentiss.github.io/hid-replay-docs/ and record a few events from
> >> your joypad? Depending on the output, we will be able to tell you
> >> where this should be fixed (but I strongly suspect that the kernel
> >> should be fixed).
> >
> > See attached idle.hid, with what appears to be noise on the Z axis when
> > the joypad is idle, and XYRxRy.hid with my approximation to the sequence
> > of physical X Y Rx Ry zero-negative-positive-zero swings.
> 
> >> On Mon, Aug 10, 2015 at 4:26 AM, Orivej Desh <orivej@gmx.fr> wrote:
> >> > 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

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

* Re: Missing axis on Gembird JPD-DUALFORCE2 since Linux 3.18
  2015-08-10 22:28       ` Orivej Desh
@ 2015-08-11 15:35         ` Benjamin Tissoires
  0 siblings, 0 replies; 6+ messages in thread
From: Benjamin Tissoires @ 2015-08-11 15:35 UTC (permalink / raw)
  To: Orivej Desh; +Cc: linux-input

On Mon, Aug 10, 2015 at 6:28 PM, Orivej Desh <orivej@gmx.fr> wrote:
> * Benjamin Tissoires
>> Thanks for the logs.
>>
>> So, yes, it appears that your joypad as a weird report descriptor.
>> It declares 2 Z axis, no Ry and one Rz.
>>
>> The first Z axis seems somewhat correlated to X, but does not seem to
>> add any actual value but noise.
>
> That's right.
>
>> If I understand correctly your problem, I can submit a patch which
>> will mute the Z axis, and provide proper Rx,Ry so you won't have to
>> deal with that in userspace.
>> Will this be OK with you?
>
> I would appreciate it if you do this, and learn to do it myself!  Yet I

OK. And sorry, I started ahead yesterday before your answer, so this
morning I already had a half-backed patch waiting for tests.

> think that Z axis is better removed than muted; it serves no purpose and
> would only confuse other users of this device (if any) when tools
> present them with 7 axes to configure.

OK. This step made the patch slightly more complicated, so in the end,
I believe I (or you if you want) might need to use a different
solution to fix this. Anyway, I'll send the patch in a few minutes. I
tested it on your logs, and they seem to behave properly now. However,
tests with real hardware are much appreciated. I can help you if you
need to set up the test kernel that you will have to rebuild (and I
can do that in French too - basing this on the @gmx.fr).

Cheers,
Benjamin

>
>> On Mon, Aug 10, 2015 at 5:36 PM, Orivej Desh <orivej@gmx.fr> wrote:
>> > * Benjamin Tissoires
>> >> Thanks for the bisect. Could you please run a hid-recorder from
>> >> http://bentiss.github.io/hid-replay-docs/ and record a few events from
>> >> your joypad? Depending on the output, we will be able to tell you
>> >> where this should be fixed (but I strongly suspect that the kernel
>> >> should be fixed).
>> >
>> > See attached idle.hid, with what appears to be noise on the Z axis when
>> > the joypad is idle, and XYRxRy.hid with my approximation to the sequence
>> > of physical X Y Rx Ry zero-negative-positive-zero swings.
>>
>> >> On Mon, Aug 10, 2015 at 4:26 AM, Orivej Desh <orivej@gmx.fr> wrote:
>> >> > 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

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

end of thread, other threads:[~2015-08-11 15:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-10  8:26 Missing axis on Gembird JPD-DUALFORCE2 since Linux 3.18 Orivej Desh
2015-08-10 14:27 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox