From: Nate Yocom <nate@yocom.org>
To: Bastien Nocera <hadess@hadess.net>
Cc: dmitry.torokhov@gmail.com,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/3] Input: joystick: xpad: Add X-Box Adaptive Controller Layer button
Date: Wed, 17 Aug 2022 10:42:57 -0700 [thread overview]
Message-ID: <Yv0ooQXqxenQ852I@ghaven-kernel> (raw)
In-Reply-To: <b32cee349fdfa6ffdc60cd31f662dbd479b01e4d.camel@hadess.net>
On Wed, Aug 17, 2022 at 12:37:25PM +0200, Bastien Nocera wrote:
> On Sat, 2022-08-13 at 11:53 -0700, Nate Yocom wrote:
> > Adds a new quirk for controllers that have a Layer button which has 4
> > states, reflected as an ABS_MISC axis with 4 values.
>
> It's called the "Profile Button" in the official documentation:
> https://support.xbox.com/en-US/help/account-profile/accessibility/get-to-know-adaptive-controller
> so best to call it that.
Agreed - thanks for the pointer, will send a v4 shortly.
> I wonder we have any other examples of profile handling in input
> drivers. The xpadneo driver implements the profiles in the kernel
> driver directly.
>
> Benjamin?
>
> Tested-by: Bastien Nocera <hadess@hadess.net>
>
> >
> > Signed-off-by: Nate Yocom <nate@yocom.org>
> > ---
> > drivers/input/joystick/xpad.c | 14 +++++++++++++-
> > 1 file changed, 13 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/input/joystick/xpad.c
> > b/drivers/input/joystick/xpad.c
> > index c8b38bb73d34..83a4f4d07af5 100644
> > --- a/drivers/input/joystick/xpad.c
> > +++ b/drivers/input/joystick/xpad.c
> > @@ -80,6 +80,7 @@
> > #define MAP_TRIGGERS_TO_BUTTONS (1 << 1)
> > #define MAP_STICKS_TO_NULL (1 << 2)
> > #define MAP_SELECT_BUTTON (1 << 3)
> > +#define MAP_LAYER_BUTTON (1 << 4)
> > #define DANCEPAD_MAP_CONFIG (MAP_DPAD_TO_BUTTONS
> > | \
> > MAP_TRIGGERS_TO_BUTTONS |
> > MAP_STICKS_TO_NULL)
> >
> > @@ -131,7 +132,7 @@ static const struct xpad_device {
> > { 0x045e, 0x02e3, "Microsoft X-Box One Elite pad", 0,
> > XTYPE_XBOXONE },
> > { 0x045e, 0x02ea, "Microsoft X-Box One S pad", 0,
> > XTYPE_XBOXONE },
> > { 0x045e, 0x0719, "Xbox 360 Wireless Receiver",
> > MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W },
> > - { 0x045e, 0x0b0a, "Microsoft X-Box Adaptive Controller", 0,
> > XTYPE_XBOXONE },
> > + { 0x045e, 0x0b0a, "Microsoft X-Box Adaptive Controller",
> > MAP_LAYER_BUTTON, XTYPE_XBOXONE },
> > { 0x045e, 0x0b12, "Microsoft Xbox Series S|X Controller",
> > MAP_SELECT_BUTTON, XTYPE_XBOXONE },
> > { 0x046d, 0xc21d, "Logitech Gamepad F310", 0, XTYPE_XBOX360
> > },
> > { 0x046d, 0xc21e, "Logitech Gamepad F510", 0, XTYPE_XBOX360
> > },
> > @@ -927,6 +928,10 @@ static void xpadone_process_packet(struct
> > usb_xpad *xpad, u16 cmd, unsigned char
> > (__u16) le16_to_cpup((__le16 *)(data
> > + 8)));
> > }
> >
> > + /* Layer button has a value of 0-4, so it is reported as an
> > axis */
> > + if (xpad->mapping & MAP_LAYER_BUTTON)
> > + input_report_abs(dev, ABS_MISC, data[34]);
> > +
> > input_sync(dev);
> > }
> >
> > @@ -1623,6 +1628,9 @@ static void xpad_set_up_abs(struct input_dev
> > *input_dev, signed short abs)
> > case ABS_HAT0Y: /* the d-pad (only if dpad is mapped to axes
> > */
> > input_set_abs_params(input_dev, abs, -1, 1, 0, 0);
> > break;
> > + case ABS_MISC: /* 4 value layer button (such as on XAC) */
> > + input_set_abs_params(input_dev, abs, 0, 4, 0, 0);
> > + break;
> > default:
> > input_set_abs_params(input_dev, abs, 0, 0, 0, 0);
> > break;
> > @@ -1715,6 +1723,10 @@ static int xpad_init_input(struct usb_xpad
> > *xpad)
> > xpad_set_up_abs(input_dev,
> > xpad_abs_triggers[i]);
> > }
> >
> > + /* setup layer button as an axis with 4 possible values */
> > + if (xpad->mapping & MAP_LAYER_BUTTON)
> > + xpad_set_up_abs(input_dev, ABS_MISC);
> > +
> > error = xpad_init_ff(xpad);
> > if (error)
> > goto err_free_input;
>
next prev parent reply other threads:[~2022-08-17 17:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-13 18:53 [PATCH v3 0/3] Input: joystick: xpad: Add X-Box Adaptive Controller support Nate Yocom
2022-08-13 18:53 ` [PATCH v3 1/3] " Nate Yocom
2022-08-17 10:37 ` Bastien Nocera
2022-08-17 17:36 ` Nate Yocom
2022-08-13 18:53 ` [PATCH v3 2/3] Input: joystick: xpad: Add X-Box Adaptive Controller Layer button Nate Yocom
2022-08-17 10:37 ` Bastien Nocera
2022-08-17 17:42 ` Nate Yocom [this message]
2022-08-24 15:36 ` Bastien Nocera
2022-08-25 22:21 ` Nate Yocom
2022-08-13 18:53 ` [PATCH v3 3/3] Input: joystick: xpad: Add X-Box Adaptive Controller XBox button Nate Yocom
2022-08-17 10:37 ` Bastien Nocera
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=Yv0ooQXqxenQ852I@ghaven-kernel \
--to=nate@yocom.org \
--cc=benjamin.tissoires@redhat.com \
--cc=dmitry.torokhov@gmail.com \
--cc=hadess@hadess.net \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@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 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).