diff mbox series

[v2] Input: increase max button number to 0x340

Message ID 20240730111810.1017708-1-tomasz.pakula.oficjalny@gmail.com (mailing list archive)
State New
Headers show
Series [v2] Input: increase max button number to 0x340 | expand

Commit Message

Tomasz Pakuła July 30, 2024, 11:17 a.m. UTC
v1 of this patch increased the number of buttons to 0x3ff. This version
reduces this number to 0x340 to decrease the size of some static arrays
by almost 200.

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 defining a large number of buttons in HID descriptor,
in turn, some of their buttons simply don't show up under linux. 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 than 80 buttons.

0x2ff was already sort of an arbitrary number, I'm increasing it to
0x340 to still keep the array not too big, while allowing additional 65
buttons.

Change has been verified on my Moza Racing R9 wheelbase + Moza racing
sequential shifter (it uses buttons 112-117). I didn't encounter any
issues whatsoever. Evey button works, every axis works. Keyboards and
other peripherals unaffected.

This patch is important as SDL uses this defines and we'll have to
wait until it propagates into release versions built on top of
(hopefully) 6.11

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

Patch

diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 4338b1b4ac44..e1699f4b1858 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		0x340
 #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..5f10f09ac174 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			0x340
 #define KEY_CNT			(KEY_MAX+1)
 
 /*