Linux Input/HID development
 help / color / mirror / Atom feed
From: Ivan Gorinov <linux-kernel@altimeter.info>
To: tomasz.pakula.oficjalny@gmail.com
Cc: Jiri Kosina <jikos@kernel.org>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] HID: input: Increase maximum number of joystick buttons
Date: Sun, 4 Jan 2026 00:48:31 +0000	[thread overview]
Message-ID: <20260104004831.GA5238@altimeter-info> (raw)
In-Reply-To: <aa40f6010c721863c09673fc8801e0a382619d89.camel@gmail.com>

On Sat, Jan 03, 2026 at 08:26:55PM +0100, tomasz.pakula.oficjalny@gmail.com wrote:
> On Sat, 2025-12-20 at 19:41 +0000, Ivan Gorinov wrote:
> > This patch increases the limit from 80 to 112 key codes.
> > 
> > If a joystick has 80 or fewer buttons, mapping stays the same.
> > 
> > If a joystick has more than 80 buttons:
> > 
> >   Map buttons [  0 ..  15 ] to key codes starting with BTN_JOYSTICK;
> >   Map buttons [ 16 ..  47 ] to key codes starting with KEY_MACRO1;
> >   Map buttons [ 48 .. 111 ] to key codes starting with BTN_TRIGGER_HAPPY.
> > 
> 
> As stated previously by Dmitry when I tried to increase the KEY_MAX for
> the same reason, the defined usages have their place and shouldn't be
> misused. I finally understood that and I have to say that this is just
> more confusing and a dirty hack, certainly used by some drivers because
> it still works with SDL and Wine (they only care about the usage index).
> 
> I'm working on a proper solution with a new event type that will only
> send button number (starting from 1 as does plain HID) and it's value.
> 
> This will support up to 65535 (u16) buttons and should be enough for
> years to come :D I'll make sure to CC you when I'll send RFC.

Thank you! I learned how to map more than 80 buttons by overriding function
hid_driver.input_mapping from your contribution to JacKeTUs/universal-pdiff
and used the same idea in my recent changes in the hid-winwing module.

Good luck in your work on new event type!
I will test your changes with my Orion2/TGRIP-18 combo.

Meanwhile, this patch could allow existing software (for example, X-Plane 12)
to work with more input devices without any changes in userspace.

      reply	other threads:[~2026-01-04  0:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-20 19:41 [PATCH] HID: input: Increase maximum number of joystick buttons Ivan Gorinov
2026-01-03 19:26 ` tomasz.pakula.oficjalny
2026-01-04  0:48   ` Ivan Gorinov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260104004831.GA5238@altimeter-info \
    --to=linux-kernel@altimeter.info \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tomasz.pakula.oficjalny@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox