Linux Input/HID development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vernon Di Carlo" <vernondicarlo@gmail.com>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH] Input: xpad - fix button mapping on Razer Atrox Xbox One
Date: Fri, 07 Aug 2026 14:22:04 +0000	[thread overview]
Message-ID: <20260807142205.3BCB81F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260807141419.7930-1-vernondicarlo@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Incorrect fallback logic for short packets on Razer Atrox Xbox One controllers
--

--- Patch [1]: [PATCH] Input: xpad - fix button mapping on Razer Atrox Xbox One ---
commit 13a313431546b71a3cf1a1ca198625dd7324af1f
Author: Vernon Di Carlo <vernondicarlo@gmail.com>

Input: xpad - fix button mapping on Razer Atrox Xbox One

This commit adds a specific mapping quirk for the Razer Atrox Arcade Stick
to swap LB/RB and correctly report the digital LT/RT states from byte 22.

> diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
> index feb8f368f834e..b9daa334e038b 100644
> --- a/drivers/input/joystick/xpad.c
> +++ b/drivers/input/joystick/xpad.c
[ ... ]
> @@ -1133,10 +1140,15 @@ static void xpadone_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char
>  
>  		/* triggers left/right */
>  		if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) {
> -			input_report_key(dev, BTN_TL2,
> -					(__u16) le16_to_cpup((__le16 *)(data + 6)));
> -			input_report_key(dev, BTN_TR2,
> -					(__u16) le16_to_cpup((__le16 *)(data + 8)));
> +			if ((xpad->mapping & MAP_ATROX) && len > 22) {
> +				input_report_key(dev, BTN_TL2, data[22] & BIT(7));
> +				input_report_key(dev, BTN_TR2, data[22] & BIT(6));
> +			} else {

[Severity: Medium]
If a Razer Atrox controller sends a packet with a length of 22 bytes or
fewer, won't this fall through to the else block?

Does this cause the driver to incorrectly interpret data[6] and data[8]
as trigger states and report spurious trigger events for this device?

> +				input_report_key(dev, BTN_TL2,
> +						(__u16) le16_to_cpup((__le16 *)(data + 6)));
> +				input_report_key(dev, BTN_TR2,
> +						(__u16) le16_to_cpup((__le16 *)(data + 8)));
> +			}
>  		} else {
>  			input_report_abs(dev, ABS_Z,
>  					(__u16) le16_to_cpup((__le16 *)(data + 6)));

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260807141419.7930-1-vernondicarlo@gmail.com?part=1

  reply	other threads:[~2026-08-07 14:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07 14:14 [PATCH] Input: xpad - fix button mapping on Razer Atrox Xbox One Vernon Di Carlo
2026-08-07 14:22 ` sashiko-bot [this message]
2026-08-07 14:41 ` [PATCH v2] " Vernon Di Carlo
2026-08-07 14:58   ` sashiko-bot

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=20260807142205.3BCB81F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vernondicarlo@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