* [PATCH] Input: increase max button number to 0x3ff
@ 2024-07-02 11:41 Tomasz Pakuła
2024-07-05 14:04 ` Michał Kopeć
0 siblings, 1 reply; 5+ messages in thread
From: Tomasz Pakuła @ 2024-07-02 11:41 UTC (permalink / raw)
To: dmitry.torokhov; +Cc: linux-input
Maximum number of buttons is limited to 0x2ff. This makes it so game
controllers like joysticks, racing wheelbases etc. are limited to 80
buttons.
A lot of input devices for flight simulators and racing simulators take
full advantage of Windows' input API limitation of 128 buttons and,
in turn, some of their buttons simply don't show up under linux. While
normally I'd say doing something just becuase other OS does, doesn't
seem like enough of a reason, Linux became quite a viable gaming
platform in the recent years so this makes it so it supports all the HID
peripherals without fuss and confusion (there aren't any dmesg errors if
HID device exceeds the 0x2ff button id).
I'm a part of linux simracing community and we encoutered this issue
with Moza Racing wheelbases, as they use top of the range for things
like h-pattern shifters, sequential shifters. These accessories simply
don't work, be it connected through the wheelbase or directly with USB.
Upcoming Moza Flight Sim devices will face the same issue, and there were
Saitek/Logitech/Honeycomb and custom-made products that also have more
then 80 buttons.
0x2ff was already sort of an arbitrary number, so I'm increasing it to
0x3ff to keep the value straight-forward.
Change has been verified on my Moza Racing R9 wheelbase + Moza racing
sequential shifter (it uses buttons 112-117).
Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
---
include/linux/mod_devicetable.h | 2 +-
include/uapi/linux/input-event-codes.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 4338b1b4ac44..c2cb3a2d0dc7 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -333,7 +333,7 @@ struct pcmcia_device_id {
/* Input */
#define INPUT_DEVICE_ID_EV_MAX 0x1f
#define INPUT_DEVICE_ID_KEY_MIN_INTERESTING 0x71
-#define INPUT_DEVICE_ID_KEY_MAX 0x2ff
+#define INPUT_DEVICE_ID_KEY_MAX 0x3ff
#define INPUT_DEVICE_ID_REL_MAX 0x0f
#define INPUT_DEVICE_ID_ABS_MAX 0x3f
#define INPUT_DEVICE_ID_MSC_MAX 0x07
diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h
index a4206723f503..a8eace215b54 100644
--- a/include/uapi/linux/input-event-codes.h
+++ b/include/uapi/linux/input-event-codes.h
@@ -808,7 +808,7 @@
/* We avoid low common keys in module aliases so they don't get huge. */
#define KEY_MIN_INTERESTING KEY_MUTE
-#define KEY_MAX 0x2ff
+#define KEY_MAX 0x3ff
#define KEY_CNT (KEY_MAX+1)
/*
--
2.45.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] Input: increase max button number to 0x3ff
2024-07-02 11:41 [PATCH] Input: increase max button number to 0x3ff Tomasz Pakuła
@ 2024-07-05 14:04 ` Michał Kopeć
2024-07-05 15:01 ` Benjamin Tissoires
0 siblings, 1 reply; 5+ messages in thread
From: Michał Kopeć @ 2024-07-05 14:04 UTC (permalink / raw)
To: tomasz.pakula.oficjalny
Cc: dmitry.torokhov, jikos, benjamin.tissoires, linux-input
Do you have any guess as to where this old value came from?
It's weird that this wasn't caught already.
CCing some more maintainers to get some more eyes on this, I hope that's okay.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Input: increase max button number to 0x3ff
2024-07-05 14:04 ` Michał Kopeć
@ 2024-07-05 15:01 ` Benjamin Tissoires
2024-07-08 10:30 ` Tomasz Pakuła
2024-07-08 10:32 ` Tomasz Pakuła
0 siblings, 2 replies; 5+ messages in thread
From: Benjamin Tissoires @ 2024-07-05 15:01 UTC (permalink / raw)
To: Michał Kopeć
Cc: tomasz.pakula.oficjalny, dmitry.torokhov, jikos,
benjamin.tissoires, linux-input
On Jul 05 2024, Michał Kopeć wrote:
> Do you have any guess as to where this old value came from?
> It's weird that this wasn't caught already.
>
> CCing some more maintainers to get some more eyes on this, I hope that's okay.
>
Dmitry will probably know better but I've made the forensic, and that
value came from 03bac96fae0e ("Input: expand keycode space").
The value seemed arbitrary, but we do try to keep it low because there
are a lot of static arrays in the kernel which are using KEY_MAX as a
size.
Also, it might be worth double checking, but last time we tried
something similar on EV_ABS range and it fell short because of the ioctl
that couldn't work properly IIRC. I don't seem to find the ML
discussion, but it would be interesting for someone to un-earth it and
see if we are facing similar issues.
Cheers,
Benjamin
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] Input: increase max button number to 0x3ff
2024-07-05 15:01 ` Benjamin Tissoires
@ 2024-07-08 10:30 ` Tomasz Pakuła
2024-07-08 10:32 ` Tomasz Pakuła
1 sibling, 0 replies; 5+ messages in thread
From: Tomasz Pakuła @ 2024-07-08 10:30 UTC (permalink / raw)
To: dmitry.torokhov
Cc: bentiss, benjamin.tissoires, jikos, linux-input, michal,
tomasz.pakula.oficjalny
This would be be really helpful in making linux even better for gaming.
It's weird that Valve didn't catch this already :)
Do you have any guess as to where this old value came from?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Input: increase max button number to 0x3ff
2024-07-05 15:01 ` Benjamin Tissoires
2024-07-08 10:30 ` Tomasz Pakuła
@ 2024-07-08 10:32 ` Tomasz Pakuła
1 sibling, 0 replies; 5+ messages in thread
From: Tomasz Pakuła @ 2024-07-08 10:32 UTC (permalink / raw)
To: dmitry.torokhov
Cc: bentiss, benjamin.tissoires, jikos, linux-input, michal,
tomasz.pakula.oficjalny
I tested this on my two machines and everythig worked perfectly. evtest
was able to detect all the buttons advertised by the wheelbase. I couldn't
test it in games running through proton as SDL has to be recompiled with
this patch applied and updated (SDL relies on this constant)
If this is a pressing matter, I could resubmit this patch but with the value
increased to 0x333 instead of 0x3ff to cut down on teh mentioned array sizing.
0x333 wuld still include support for 128 buttons. 0x3ff would be more
future-proof, but we can always adjust this value later.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-07-08 10:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-02 11:41 [PATCH] Input: increase max button number to 0x3ff Tomasz Pakuła
2024-07-05 14:04 ` Michał Kopeć
2024-07-05 15:01 ` Benjamin Tissoires
2024-07-08 10:30 ` Tomasz Pakuła
2024-07-08 10:32 ` Tomasz Pakuła
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).