From patchwork Thu Aug 25 22:24:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nate Yocom X-Patchwork-Id: 12955301 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB8A7ECAAA2 for ; Thu, 25 Aug 2022 22:24:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244339AbiHYWYm (ORCPT ); Thu, 25 Aug 2022 18:24:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238261AbiHYWYj (ORCPT ); Thu, 25 Aug 2022 18:24:39 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A41D5C578D for ; Thu, 25 Aug 2022 15:24:37 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id w2so70866pld.0 for ; Thu, 25 Aug 2022 15:24:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yocom-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=vTaJzQMO9aQaSOztqsBCXeGz2f0zGMSY5MlxCdWwSg8=; b=XnjJkmq6u8U4v8LTvkmJXfZqTtNkoIPS2vXVr6w6A31HXSAKy3omT0D6Hu3vy/y9f6 6KbNrzL6Ga/Kmoy3sYuKNkjTKnebJw5l7D0Yv02Cykq08nK4w60sV2Bl+bpDLdpNKC9W 7DBjT6Q0EOF11ssVZu2d2SG4lFT8luTotjDuRhnNHvCTZITEDGgycasInYxso+/crnRW NzbsxC7dgiSA7+/9vC0IT+yyI9AVLb7Q/405BEhDIAWBAW9qCt54EwGLxumqvD44IxvD u3JMRl8ZEhv7LEVyiL4gMJ/z1cl+Cy7HJuQGVKO5eWp7NIL32gwvVJRvUnflJLAN+1Xv 65Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=vTaJzQMO9aQaSOztqsBCXeGz2f0zGMSY5MlxCdWwSg8=; b=KGlHxulzt0kbomiqyBm3892sG3QC0XlihdM/OpYoGcqS8gD7WQtcVT35/JYEDG7QjT HOG6paRrZdIYaR4iw7eLnwPpJQpa8cALG0TrLNvxelP8kNENj0WQu/HRkyh4LED7iVTH kzUUL2rkY+HObwVMFoh1F5WZouRYBLQeZJJp3VV1HDX8h+Aj9BOXVhhSFCFpXZLwPNxc jk4IfQzC/3e/3e/TcxphpbyG/j463V3kEsZOXvkg855lKyem4bYFMD+D5ebG8VjhvaKm CKipqLam5HDC4mC1YySYV0TXbN+zWEOS9PteHFZ2PsVM0q3exClg41XUDBdL3Xvl+kJr rBKQ== X-Gm-Message-State: ACgBeo0ZWChlkCrE0FJecVqcVqGWXZmb74aZpl+Eoz7AcD5ydwsK57f5 RIOxe2zxZuDxpoM70LpJENdIhA== X-Google-Smtp-Source: AA6agR4LjPJYprSCKGQdARvvaSzcXHKYqunWoN7K+wLtj3MBvKXjL3vhYsWfkFMNvHUT2JgeiTnMOA== X-Received: by 2002:a17:902:7c8a:b0:16f:4d4:ced8 with SMTP id y10-20020a1709027c8a00b0016f04d4ced8mr1015727pll.15.1661466277179; Thu, 25 Aug 2022 15:24:37 -0700 (PDT) Received: from localhost.localdomain ([2601:600:8f80:973::5f]) by smtp.gmail.com with ESMTPSA id e23-20020a63db17000000b00429b6e6c539sm81820pgg.61.2022.08.25.15.24.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Aug 2022 15:24:36 -0700 (PDT) From: Nate Yocom To: dmitry.torokhov@gmail.com Cc: nate@yocom.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, hadess@hadess.net, benjamin.tissoires@redhat.com Subject: [PATCH v5 1/4] Input: joystick: xpad: Add X-Box Adaptive Controller support Date: Thu, 25 Aug 2022 15:24:17 -0700 Message-Id: <20220825222420.6833-2-nate@yocom.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220825222420.6833-1-nate@yocom.org> References: <20220825222420.6833-1-nate@yocom.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Adds correct VID/PID for this XTYPE_XBOXONE compatible controller to xpad_device[] table. Signed-off-by: Nate Yocom Tested-by: Bastien Nocera --- drivers/input/joystick/xpad.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 18190b529bca..c8b38bb73d34 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -131,6 +131,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, 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 }, From patchwork Thu Aug 25 22:24:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nate Yocom X-Patchwork-Id: 12955300 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C707ECAAD1 for ; Thu, 25 Aug 2022 22:24:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244357AbiHYWYl (ORCPT ); Thu, 25 Aug 2022 18:24:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242426AbiHYWYj (ORCPT ); Thu, 25 Aug 2022 18:24:39 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65633C5795 for ; Thu, 25 Aug 2022 15:24:38 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id p9-20020a17090a2d8900b001fb86ec43aaso6266972pjd.0 for ; Thu, 25 Aug 2022 15:24:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yocom-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=fNEsgZ1Ns/g0prglNDQsUbLzaltKYTohJK8Yy9WMqdY=; b=TKL3A+eMM2fTtq6szDteKKLdwDi7eZV+SVsC26hkah3dD/l21vHMuPpRrQSbAzS2Be JfeS9XOpBSVZPzXNDT7/qD4DSeRqYElL72rBVZ00+lIp3rqcBE0biZGURsS5IvwmrIrQ /KlWwFu+r98vzqKSVMxoGNouh/FnuHWxmaSjjXrnY+LpqHt2nuzvZLhOgcGQz48Pt1+W a2Qiz4yNK0Xw9wp+D618awmXkENmwiVPRhUEPL/MLTnUbhGYsQIQTeFoyiYOrrklYhLO I/b4TcU00Bus4ew0DkAJEYfEkpHD3i8hfbX0ZiBBf2kbbTDL5cs+mO17CU8AJ7WM4xyP HF/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=fNEsgZ1Ns/g0prglNDQsUbLzaltKYTohJK8Yy9WMqdY=; b=v1L3DXNv3J2bXtNV7OJPggx9WwDEiLjuf4qL66CZqwdzz9CUYIuXZFoViOm4aBV4QQ ncJPUMsXdlIyiMCe23nHnGuKoSkDec1MDTK63L+KeFreeWHf4U5NaNXU7Osd7pfCU3qv XnT7nMM6C1jTiDcJD05KqXQOU+Hr5noxft+7rCJzfjSDhYev3p/lmeZC5s27ETjajbgo ADTFBiiNGPdRfq5Qmv19wayIioLTUtfMtPNazoukrvhQ3qoauDqjeJhaik/kPJdF16/t Mcn5Gma7tmXbFjk+wuwz/LKK/S1pkqhDpUY1MhnZBEKhXW5Rwk6DH+MrRZlLEu0odvTs 5aYg== X-Gm-Message-State: ACgBeo1cdUaIEcIWAjAe323x/lfNS/qsjbbb2unW/PnuE9WSmyhT2Ihz rVQxBOqqRPWCe9SL3m+lJAVM6Q== X-Google-Smtp-Source: AA6agR4X2tsIMZYrg95n+CjTbebFE1XszyaKqu0/9LhagIPxG7iSOoPoQfOyNxjnlWo6shvlYMKe9Q== X-Received: by 2002:a17:90a:ee96:b0:1fa:af87:95f9 with SMTP id i22-20020a17090aee9600b001faaf8795f9mr1128961pjz.243.1661466277948; Thu, 25 Aug 2022 15:24:37 -0700 (PDT) Received: from localhost.localdomain ([2601:600:8f80:973::5f]) by smtp.gmail.com with ESMTPSA id e23-20020a63db17000000b00429b6e6c539sm81820pgg.61.2022.08.25.15.24.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Aug 2022 15:24:37 -0700 (PDT) From: Nate Yocom To: dmitry.torokhov@gmail.com Cc: nate@yocom.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, hadess@hadess.net, benjamin.tissoires@redhat.com Subject: [PATCH v5 2/4] Input: joystick: xpad: Add ABS_PROFILE axis value to uapi Date: Thu, 25 Aug 2022 15:24:18 -0700 Message-Id: <20220825222420.6833-3-nate@yocom.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220825222420.6833-1-nate@yocom.org> References: <20220825222420.6833-1-nate@yocom.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Add an ABS_PROFILE axis for input devices which need it, e.g. X-Box Adaptive Controller and X-Box Elite 2. --- include/uapi/linux/input-event-codes.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h index dff8e7f17074..7ad931a32970 100644 --- a/include/uapi/linux/input-event-codes.h +++ b/include/uapi/linux/input-event-codes.h @@ -862,6 +862,7 @@ #define ABS_TOOL_WIDTH 0x1c #define ABS_VOLUME 0x20 +#define ABS_PROFILE 0x21 #define ABS_MISC 0x28 From patchwork Thu Aug 25 22:24:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nate Yocom X-Patchwork-Id: 12955302 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1A3FECAAD4 for ; Thu, 25 Aug 2022 22:24:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238261AbiHYWYm (ORCPT ); Thu, 25 Aug 2022 18:24:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244190AbiHYWYk (ORCPT ); Thu, 25 Aug 2022 18:24:40 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32A65C3F60 for ; Thu, 25 Aug 2022 15:24:39 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id h11-20020a17090a470b00b001fbc5ba5224so1685919pjg.2 for ; Thu, 25 Aug 2022 15:24:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yocom-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=RadgG83WWa4faHpqBE1rZrrs1XrwjergMGKfR9KHj1E=; b=WLHay7cHzXyTv10asVvWKdXH+2pVHOLoPnd6N7Cjk9GRWGu5ksjOkUbBD3yU0nm6AX EnslDc4NywiHEANmvggunDmGLl9mOYjXH2Rm+qAfhaYs9fxCg15AuFA2OEDdL91Edz9G 9XcqGyxngcducRt1RbvwcDpe7zwVM+PeRHd+I+o2s4F6labGsTYHuOqjXEPO0q8UdYQI XToS5KD6I/H9gQK7WEseTWsvyNQzs9+fc8Rn86l4j6cgCb1BxVNBtp07Swku38GcKLWF angHxo0cOmdQ94d93XKxqlJ5wzyGK8pwSx/3O6ocTSYP8evTjcpHH9W6YKUv7cBwAj/N wl1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=RadgG83WWa4faHpqBE1rZrrs1XrwjergMGKfR9KHj1E=; b=lzZw1HoJqLoOCFuMAGBEnRWUfm3oU6iB2MfGgb3J/hw9Re4kdPUFAb/ByMjnC15azx 3ZeJba6pYpHZX5hlqy8HzjO6V2rRR/oiL0dyQcpDldCURyVi0BtAvKen9cR0QZ6HhT1S /qtwnX73QdcH/S84ZWd1GxaM1YI3h/Gxw15I1GKLbwoPonLO+z6D2HP3+H0lfMRfBI9O Usj0bkAIaSdfGMRCkRdel7leEDKyhRq+gG3DpoE521tJpE50WSjoTr6VL6xz70rUmJB2 1xSPuK+OERPmVfvpnEqkl0PP/Esh6b3FdH/LXcPMB6uZuRDDkYMLCnNDF0rXU3GuhCsl m4Kg== X-Gm-Message-State: ACgBeo0BciRAwd3/u3zvwrdKuvkiK6bMflDf55Se8V3lW2LWqw8OA0R0 /kaCM9f+OAcRnMD8tCZn7hUqJA== X-Google-Smtp-Source: AA6agR48sZ3vduQgsEP2EBX/tvxsSK1d6ePZxssCzRsia8eNCik0Kbf+Bsf/Cni0qjwoKxQ+WyIOJQ== X-Received: by 2002:a17:90a:f48d:b0:1f7:2e00:f7f8 with SMTP id bx13-20020a17090af48d00b001f72e00f7f8mr1302071pjb.94.1661466278714; Thu, 25 Aug 2022 15:24:38 -0700 (PDT) Received: from localhost.localdomain ([2601:600:8f80:973::5f]) by smtp.gmail.com with ESMTPSA id e23-20020a63db17000000b00429b6e6c539sm81820pgg.61.2022.08.25.15.24.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Aug 2022 15:24:38 -0700 (PDT) From: Nate Yocom To: dmitry.torokhov@gmail.com Cc: nate@yocom.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, hadess@hadess.net, benjamin.tissoires@redhat.com Subject: [PATCH v5 3/4] Input: joystick: xpad: Add X-Box Adaptive Controller Profile button Date: Thu, 25 Aug 2022 15:24:19 -0700 Message-Id: <20220825222420.6833-4-nate@yocom.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220825222420.6833-1-nate@yocom.org> References: <20220825222420.6833-1-nate@yocom.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Adds a new quirk for controllers that have a Profile button which has 4 states, reflected as an ABS_PROFILE axis with 4 values. Signed-off-by: Nate Yocom Tested-by: Bastien Nocera --- 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..9557e4768f14 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_PROFILE_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_PROFILE_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))); } + /* Profile button has a value of 0-3, so it is reported as an axis */ + if (xpad->mapping & MAP_PROFILE_BUTTON) + input_report_abs(dev, ABS_PROFILE, 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_PROFILE: /* 4 value profile 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 profile button as an axis with 4 possible values */ + if (xpad->mapping & MAP_PROFILE_BUTTON) + xpad_set_up_abs(input_dev, ABS_PROFILE); + error = xpad_init_ff(xpad); if (error) goto err_free_input; From patchwork Thu Aug 25 22:24:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nate Yocom X-Patchwork-Id: 12955303 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 637AEECAAD5 for ; Thu, 25 Aug 2022 22:24:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244369AbiHYWYn (ORCPT ); Thu, 25 Aug 2022 18:24:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244351AbiHYWYk (ORCPT ); Thu, 25 Aug 2022 18:24:40 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB4D9C5787 for ; Thu, 25 Aug 2022 15:24:39 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id g8so18176plq.11 for ; Thu, 25 Aug 2022 15:24:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yocom-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=AMvwQEDYyViZsL8j6NoVlVoUIIpz5J/YqO+FfmJYCms=; b=ToRlzjgTCDM5+dvAPgiCxfDNVf5k8nwWj4Dn7+hOfXzRlzCJyKd3pYcEuYXdQVMx18 O/jwYLfAM4VximZtvVj5YWpB1p/R4Sp1ICF/sLljblO/ZupgFVu/F2KF5hDnrv+Q3E9a uvt2VojDxzwqS8ym/wHvaEnluwuVv9p5sfQWgJ11VXUfkEFNtni2ZTmW8VVwp/pQEYEb Bj6zzieMLhkEoE2JvHpFYWQouAPTcT776uL2ylVmNhuqXcw6a4fnjK24hb4LYFI4RyEz qcJEtq6cCKXxO6Sueus/Sh7gPA1GOr2Lx7WTEonZJcszUBpH15q3V8QWANNRe9eq5Qey lOaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=AMvwQEDYyViZsL8j6NoVlVoUIIpz5J/YqO+FfmJYCms=; b=FWnmnW/obLo02XdVeE5L/WKCA84Gt4VlWme1ivVW89XqCF0LKOgLkB7laVfUV+2iTR 7qo0nLW5et9fYVG05FxM9/Qc5Y+RYqX+SCIDNbChsN8aero5QgoRL4Rc/IFPmJQfGt+X zyFMwV4FIltttthqTRfjfaLx2yK/c9z/IT1QLmTXkSlZ60RT9lPOhMDg2ANT1butTxnk hSKSH15mPWW2AKxnFEQlFbWOQjAyX6P2IgxLlftTa+7assIyvIaziqm6+QhEuepC6ZhO EpUb84SMohVttGYQ6ukVgznSCzihJmxFLrmkqEudGittRVy0qZojam2Z7Wffq2sQ9u7C sjpw== X-Gm-Message-State: ACgBeo2VAajg9KzbCXLhe6tFuGnJVfMa9QK/SOlCojupBMk++7rh50CN R+Xyj40tTRpgL3rS+Jc4wcy69A== X-Google-Smtp-Source: AA6agR6mEn+GnBN38cs7xJtLdYSoxtp7xXPbZgg/NqzoRDV+mtg8TO7vG0Gxsd9LMa39Jrs/8Z2PNA== X-Received: by 2002:a17:902:da8f:b0:16f:e43:efda with SMTP id j15-20020a170902da8f00b0016f0e43efdamr1007466plx.164.1661466279510; Thu, 25 Aug 2022 15:24:39 -0700 (PDT) Received: from localhost.localdomain ([2601:600:8f80:973::5f]) by smtp.gmail.com with ESMTPSA id e23-20020a63db17000000b00429b6e6c539sm81820pgg.61.2022.08.25.15.24.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Aug 2022 15:24:39 -0700 (PDT) From: Nate Yocom To: dmitry.torokhov@gmail.com Cc: nate@yocom.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, hadess@hadess.net, benjamin.tissoires@redhat.com Subject: [PATCH v5 4/4] Input: joystick: xpad: Add X-Box Adaptive Controller XBox button Date: Thu, 25 Aug 2022 15:24:20 -0700 Message-Id: <20220825222420.6833-5-nate@yocom.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220825222420.6833-1-nate@yocom.org> References: <20220825222420.6833-1-nate@yocom.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org 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 Tested-by: Bastien Nocera --- 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 9557e4768f14..ece38f00dfff 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; }