]> git.baikalelectronics.ru Git - kernel.git/commitdiff
Input: xpad - add X-Box Adaptive XBox button
authorNate Yocom <nate@yocom.org>
Thu, 29 Sep 2022 01:18:54 +0000 (18:18 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 29 Sep 2022 01:31:36 +0000 (18:31 -0700)
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 <nate@yocom.org>
Tested-by: Bastien Nocera <hadess@hadess.net>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com
Link: https://lore.kernel.org/r/20220908173930.28940-3-nate@yocom.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/joystick/xpad.c

index 1058ed28be491228f28741f9f3c9168c3bac2855..c66ae73523d2c0eec2de95d8fb1766d3245ad7a5 100644 (file)
@@ -969,7 +969,8 @@ static void xpadone_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char
                if (data[1] == (GIP_OPT_ACK | GIP_OPT_INTERNAL))
                        xpadone_ack_mode_report(xpad, data[2]);
 
-               input_report_key(dev, BTN_MODE, data[4] & BIT(0));
+               input_report_key(dev, BTN_MODE, data[4] & GENMASK(1, 0));
+               input_sync(dev);
 
                do_sync = true;
        } else if (data[0] == GIP_CMD_FIRMWARE) {