Missing axis on Gembird JPD-DUALFORCE2 since Linux 3.18
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 <[email protected]> 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.
drivers/hid/hid-input.c +6 -0
@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi,
Quoted 9 lines · Orivej Desh
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
Quoted 8 lines
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
Quoted 55 lines
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]
commit79346d620e9de87912de73337f6df8b7f9a46888Author: Benjamin Tissoires <[email protected]> Date: Mon Aug 25 13:07:10 2014 -0400HID: 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 <[email protected]>Signed-off-by Benjamin Tissoires <[email protected]>Signed-off-by Jiri Kosina <[email protected]>drivers/hid/hid-input.c +6
-0@@ -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
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
* Benjamin Tissoires
Quoted 5 lines
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.
Quoted 71 lines · Orivej Desh
Quoted 70 lines
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]
commit79346d620e9de87912de73337f6df8b7f9a46888Author: Benjamin Tissoires <[email protected]> Date: Mon Aug 25 13:07:10 2014 -0400HID: 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 <[email protected]>Signed-off-by Benjamin Tissoires <[email protected]>Signed-off-by Jiri Kosina <[email protected]>drivers/hid/hid-input.c +6
-0@@ -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
Quoted 10 lines · Orivej Desh
* Benjamin Tissoires
Quoted 5 lines
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
Quoted 65 lines
Quoted 65 lines · Orivej Desh
Quoted 63 lines
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]
commit79346d620e9de87912de73337f6df8b7f9a46888Author: Benjamin Tissoires <[email protected]> Date: Mon Aug 25 13:07:10 2014 -0400HID: 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 <[email protected]>Signed-off-by Benjamin Tissoires <[email protected]>Signed-off-by Jiri Kosina <[email protected]>drivers/hid/hid-input.c +6
-0@@ -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 );
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
[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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
* Benjamin Tissoires
Quoted 7 lines
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.
Quoted 4 lines
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.
Quoted 76 lines · Orivej Desh
Quoted 75 lines
* Benjamin Tissoires
Quoted 5 lines
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.
Quoted 64 lines · Orivej Desh
Quoted 63 lines
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]
commit79346d620e9de87912de73337f6df8b7f9a46888Author: Benjamin Tissoires <[email protected]> Date: Mon Aug 25 13:07:10 2014 -0400HID: 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 <[email protected]>Signed-off-by Benjamin Tissoires <[email protected]>Signed-off-by Jiri Kosina <[email protected]>drivers/hid/hid-input.c +6
-0@@ -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 );
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
[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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · Orivej Desh
* Benjamin Tissoires
Quoted 7 lines
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.
Quoted 8 lines
That's right.
Quoted 4 lines
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.
Quoted 3 lines
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
Quoted 77 lines
Quoted 77 lines · Orivej Desh
Quoted 75 lines
* Benjamin Tissoires
Quoted 5 lines
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.
Quoted 64 lines · Orivej Desh
Quoted 63 lines
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]
commit79346d620e9de87912de73337f6df8b7f9a46888Author: Benjamin Tissoires <[email protected]> Date: Mon Aug 25 13:07:10 2014 -0400HID: 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 <[email protected]>Signed-off-by Benjamin Tissoires <[email protected]>Signed-off-by Jiri Kosina <[email protected]>drivers/hid/hid-input.c +6
-0@@ -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 );
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
[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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html