All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cameron <cameronghall@cox.net>
To: linux-input@vger.kernel.org
Subject: Update: Wrong button mappings reported by evdev with PowerA Nintendo Switch gamepad
Date: Thu, 3 Mar 2022 07:57:36 -0600	[thread overview]
Message-ID: <20220303075736.5ea97dde@cameron-pc> (raw)
In-Reply-To: <51E98AD1-6622-4ED2-8C08-18F1AADC3838@cox.net>

On Wed, 02 Mar 2022 12:45:17 -0600
Cameron <cameronghall@cox.net> wrote:

> Hello all,
> 
> This is my first time reporting a kernel issue, so please let me know
> if this is not the right place to report it. I am using a third party
> PowerA USB wired Switch controller on Void Linux. Games and
> applications are able to successfully detect and use the controller,
> however the button mapping is very wrong in every program I have
> tested. I tested this with evtest-qt to see what button values evdev
> is reporting. Since there appears to be no way to remap these from
> userspace, I suspect the problem lies in the kernel driver.
> 
> Pressing the two analog sticks (which should be BTN_THUMBL and
> BTN_THUMBR) incorrectly generate events for BTN_SELECT and BTN_START,
> and pressing the + and - buttons (which should be mapped to BTN_START
> and BTN_SELECT) instead result in BTN_TL2 and BTN_TR2 events.
> 
> The device in question (as reported by lsusb) is:
> Bus 001 Device 003: ID 20d6:a711 Core (Plus) Wired Controller
> and I am using kernel version 5.15.26_1 on Void Linux.
> 
> I understand that this gamepad is intended to be used with the
> Nintendo Switch console, so it may not be as HID compliant as, say, a
> Logitech. However the kernel has a standard for how these buttons are
> to be mapped, which the driver used for this gamepad appears to
> violate. https://www.kernel.org/doc/html/v4.13/input/gamepad.html
> Section 4.3 states: "All new gamepads are supposed to comply with
> this mapping. Please report any bugs, if they don’t."
> 
> I can provide more info if needed.
> 
> Thanks,
> Cameron

So, here's an update on this situation. I managed to hack around
this situation by writing a simple kernel module to override the button
mapping for this device. The code for the module can be found on my
GitHub here:
https://gist.github.com/camthesaxman/af7099505103a555518741b4083eaea8
I have almost zero experience with kernel development, so I don't know
how this kind of thing would be properly fixed in-tree (perhaps
something with hid-quirks.c?) and make a proper patch for the kernel.

Thanks,
Cameron

      reply	other threads:[~2022-03-03 13:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-02 18:45 Wrong button mappings reported by evdev with PowerA Nintendo Switch gamepad Cameron
2022-03-03 13:57 ` Cameron [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=20220303075736.5ea97dde@cameron-pc \
    --to=cameronghall@cox.net \
    --cc=linux-input@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.