From: Aaron Ma <mapengyu@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
linux-input@vger.kernel.org (open list:INPUT (KEYBOARD, MOUSE,
JOYSTICK, TOUCHSCREEN)...),
linux-kernel@vger.kernel.org
Cc: Sanjay Govind <sanjay.govind9@gmail.com>,
Vicki Pfau <vi@endrift.com>, Shengyu Qu <wiagn233@outlook.com>,
Aaron Ma <mapengyu@gmail.com>, Qbeliw Tanaka <q.tanaka@gmx.com>,
Elliot Tester <elliotctester@gmail.com>,
Kees Cook <kees@kernel.org>, Dmitriy Zharov <contact@zharov.dev>
Subject: [PATCH 1/2] Input: xpad - query MS OS descriptor for BTP-KP20D
Date: Sat, 25 Jul 2026 15:28:12 +0800 [thread overview]
Message-ID: <20260725072813.339112-1-mapengyu@gmail.com> (raw)
The Beitong BTP-KP20D dongle cycles through its operating modes and
never becomes usable unless the host requests the Microsoft OS string
descriptor at index 0xee. Windows makes this request while discovering
the XUSB10 compatible ID, but Linux USB core does not query Microsoft
OS descriptors.
Add a device-specific quirk that performs the request during probe,
allowing the dongle to remain in Xbox 360 mode.
Signed-off-by: Aaron Ma <mapengyu@gmail.com>
---
drivers/input/joystick/xpad.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index feb8f368f834e..1616047e65f5e 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -72,6 +72,7 @@
#define PKT_XBE2_FW_5_11 4
#define FLAG_DELAY_INIT BIT(0)
+#define FLAG_MS_OS_DESC BIT(1)
static bool dpad_to_buttons;
module_param(dpad_to_buttons, bool, S_IRUGO);
@@ -334,6 +335,7 @@ static const struct xpad_device {
{ 0x1ee9, 0x1590, "ZOTAC Gaming Zone", 0, XTYPE_XBOX360 },
{ 0x20bc, 0x5134, "BETOP BTP-KP50B Xinput Dongle", 0, XTYPE_XBOX360 },
{ 0x20bc, 0x514a, "BETOP BTP-KP50C Xinput Dongle", 0, XTYPE_XBOX360 },
+ { 0x20bc, 0x5159, "Beitong BTP-KP20D Controller", 0, XTYPE_XBOX360, FLAG_MS_OS_DESC },
{ 0x20d6, 0x2001, "BDA Xbox Series X Wired Controller", 0, XTYPE_XBOXONE },
{ 0x20d6, 0x2009, "PowerA Enhanced Wired Controller for Xbox Series X|S", 0, XTYPE_XBOXONE },
{ 0x20d6, 0x2064, "PowerA Wired Controller for Xbox", MAP_SHARE_BUTTON, XTYPE_XBOXONE },
@@ -786,6 +788,24 @@ static int xpad_start_input(struct usb_xpad *xpad);
static void xpadone_ack_mode_report(struct usb_xpad *xpad, u8 seq_num);
static void xpad360w_poweroff_controller(struct usb_xpad *xpad);
+static void xpad_query_ms_os_descriptor(struct usb_device *udev)
+{
+ u8 *descriptor;
+ int error;
+
+ descriptor = kmalloc(18, GFP_KERNEL);
+ if (!descriptor)
+ return;
+
+ error = usb_get_descriptor(udev, USB_DT_STRING, 0xee,
+ descriptor, 18);
+ if (error != 18)
+ dev_warn(&udev->dev,
+ "unable to query MS OS descriptor: %d\n", error);
+
+ kfree(descriptor);
+}
+
/*
* xpad_process_packet
*
@@ -2055,6 +2075,9 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
break;
}
+ if (xpad_device[i].flags & FLAG_MS_OS_DESC)
+ xpad_query_ms_os_descriptor(udev);
+
xpad = kzalloc_obj(*xpad);
if (!xpad)
return -ENOMEM;
--
2.53.0
next reply other threads:[~2026-07-25 7:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-25 7:28 Aaron Ma [this message]
2026-07-25 7:28 ` [PATCH 2/2] Input: xpad - add wired Beitong BTP-KP20D support Aaron Ma
2026-07-25 7:48 ` 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=20260725072813.339112-1-mapengyu@gmail.com \
--to=mapengyu@gmail.com \
--cc=contact@zharov.dev \
--cc=dmitry.torokhov@gmail.com \
--cc=elliotctester@gmail.com \
--cc=kees@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=q.tanaka@gmx.com \
--cc=sanjay.govind9@gmail.com \
--cc=vi@endrift.com \
--cc=wiagn233@outlook.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