2022-08-13 19:23:44

by Nate Yocom

[permalink] [raw]
Subject: [PATCH v3 3/3] Input: joystick: xpad: Add X-Box Adaptive Controller XBox button

Adaptive controller sets 0x02 bit for this button, all others set 0x01
so presence of either is used for BTN_MODE.

Signed-off-by: Nate Yocom <[email protected]>
---
drivers/input/joystick/xpad.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 83a4f4d07af5..bea71721b6cd 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -859,7 +859,7 @@ static void xpadone_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char
if (data[1] == 0x30)
xpadone_ack_mode_report(xpad, data[2]);

- input_report_key(dev, BTN_MODE, data[4] & 0x01);
+ input_report_key(dev, BTN_MODE, data[4] & 0x03);
input_sync(dev);
return;
}
--
2.30.2


2022-08-17 11:33:19

by Bastien Nocera

[permalink] [raw]
Subject: Re: [PATCH v3 3/3] Input: joystick: xpad: Add X-Box Adaptive Controller XBox button

On Sat, 2022-08-13 at 11:53 -0700, Nate Yocom wrote:
> Adaptive controller sets 0x02 bit for this button, all others set
> 0x01
> so presence of either is used for BTN_MODE.
>
> Signed-off-by: Nate Yocom <[email protected]>

Tested-by: Bastien Nocera <[email protected]>

> ---
>  drivers/input/joystick/xpad.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/input/joystick/xpad.c
> b/drivers/input/joystick/xpad.c
> index 83a4f4d07af5..bea71721b6cd 100644
> --- a/drivers/input/joystick/xpad.c
> +++ b/drivers/input/joystick/xpad.c
> @@ -859,7 +859,7 @@ static void xpadone_process_packet(struct
> usb_xpad *xpad, u16 cmd, unsigned char
>                 if (data[1] == 0x30)
>                         xpadone_ack_mode_report(xpad, data[2]);
>  
> -               input_report_key(dev, BTN_MODE, data[4] & 0x01);
> +               input_report_key(dev, BTN_MODE, data[4] & 0x03);
>                 input_sync(dev);
>                 return;
>         }