Input: joydev - Recognize joysticks with Z axis as joysticks.

Started by Ville Ranki on Aug 25, 2016 · 6 messages from 2 authors · Last reply Sep 15, 2016

Subsystems (2)

Maintainers (2)

STALE3719d

open the first message on its own page

Message details and related content
Current implementation of joydev's input_device_id
table recognizes only devices with ABS_X, ABS_WHEEL
or ABS_THROTTLE axes as joysticks.

There are joystick devices that do not have those axes,
for example TRC Rudder device. The device in question
has ABS_Z, ABS_RX and ABS_RY axes causing it not being
detected as joystick.

This patch adds ABS_Z to the input_device_id list
allowing devices with ABS_Z axis to be detected
correctly.

Signed-off-by: Ville Ranki <redacted>
---
 drivers/input/joydev.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index 5d11fea..f3135ae 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -950,6 +950,12 @@ static const struct input_device_id joydev_ids[] = {
 		.flags = INPUT_DEVICE_ID_MATCH_EVBIT |
 				INPUT_DEVICE_ID_MATCH_ABSBIT,
 		.evbit = { BIT_MASK(EV_ABS) },
+		.absbit = { BIT_MASK(ABS_Z) },
+	},
+	{
+		.flags = INPUT_DEVICE_ID_MATCH_EVBIT |
+				INPUT_DEVICE_ID_MATCH_ABSBIT,
+		.evbit = { BIT_MASK(EV_ABS) },
 		.absbit = { BIT_MASK(ABS_WHEEL) },
 	},
 	{
-- 
2.7.4
Message details and related content
On Thu, Aug 25, 2016 at 05:16:50PM +0300, Ville Ranki wrote:
Current implementation of joydev's input_device_id
table recognizes only devices with ABS_X, ABS_WHEEL
or ABS_THROTTLE axes as joysticks.

There are joystick devices that do not have those axes,
for example TRC Rudder device. The device in question
has ABS_Z, ABS_RX and ABS_RY axes causing it not being
detected as joystick.

This patch adds ABS_Z to the input_device_id list
allowing devices with ABS_Z axis to be detected
correctly.
I am curious why you still use joydev and not switch your client(s) to
evdev? Or is it some legacy game?

Thanks.
quoted hunk
Signed-off-by: Ville Ranki <redacted>
---
 drivers/input/joydev.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index 5d11fea..f3135ae 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -950,6 +950,12 @@ static const struct input_device_id joydev_ids[] = {
 		.flags = INPUT_DEVICE_ID_MATCH_EVBIT |
 				INPUT_DEVICE_ID_MATCH_ABSBIT,
 		.evbit = { BIT_MASK(EV_ABS) },
+		.absbit = { BIT_MASK(ABS_Z) },
+	},
+	{
+		.flags = INPUT_DEVICE_ID_MATCH_EVBIT |
+				INPUT_DEVICE_ID_MATCH_ABSBIT,
+		.evbit = { BIT_MASK(EV_ABS) },
 		.absbit = { BIT_MASK(ABS_WHEEL) },
 	},
 	{
-- 
2.7.4
-- 
Dmitry
Message details and related content
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/25/2016 07:45 PM, Dmitry Torokhov wrote:
quoted
This patch adds ABS_Z to the input_device_id list allowing
devices with ABS_Z axis to be detected correctly.
I am curious why you still use joydev and not switch your client(s)
to evdev? Or is it some legacy game?
Yes, this is about legacy games. For example X-Plane requires
joystick node to be present.

- -- 
Ville Ranki [off-list ref]
http://www.iki.fi/~cos
PGP public key: http://www.iki.fi/~cos/vranki_pub.asc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEYEARECAAYFAle/W3UACgkQVm11nqR7UVwysgCcDb9WIsMKC9qNPHxMWA9rFSqM
7YcAnibn2E02M4/7v7QjD0wuD3QdJMhG
=DjXV
-----END PGP SIGNATURE-----
Message details and related content
On 08/25/2016 11:56 PM, Ville Ranki wrote:
On 08/25/2016 07:45 PM, Dmitry Torokhov wrote:
quoted
quoted
This patch adds ABS_Z to the input_device_id list allowing 
devices with ABS_Z axis to be detected correctly.
quoted
I am curious why you still use joydev and not switch your
client(s) to evdev? Or is it some legacy game?
Yes, this is about legacy games. For example X-Plane requires 
joystick node to be present.
Was this patch accepted or rejected? In distros event devices are
not readable by non-root users by default while joystick devices are.
These can be changed with udev rules, but IMO joystick detection
should be fixed on kernel level.

-- 
Ville Ranki [off-list ref]
http://www.iki.fi/~cos
PGP public key: http://www.iki.fi/~cos/vranki_pub.asc
Message details and related content
On Thu, Aug 25, 2016 at 05:16:50PM +0300, Ville Ranki wrote:
Current implementation of joydev's input_device_id
table recognizes only devices with ABS_X, ABS_WHEEL
or ABS_THROTTLE axes as joysticks.

There are joystick devices that do not have those axes,
for example TRC Rudder device. The device in question
has ABS_Z, ABS_RX and ABS_RY axes causing it not being
detected as joystick.

This patch adds ABS_Z to the input_device_id list
allowing devices with ABS_Z axis to be detected
correctly.

Signed-off-by: Ville Ranki <redacted>
Applied, thank you.

Although I wonder if we could not move joydev implementation to
userspace in the long run.

Thanks.

-- 
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help