mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hani B <itshanibee@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Hani B <itshanibee@gmail.com>
Subject: [PATCH for-next] Input: xpad - add support for Flydigi Direwolf 4 paddles
Date: Fri,  4 Sep 2026 00:36:39 +0530	[thread overview]
Message-ID: <20260903190639.344878-1-itshanibee@gmail.com> (raw)

The Flydigi Direwolf 4 clones Microsoft's Xbox 360 controller (045e:028e),
identifies itself via its USB product string, and reports two rear paddles
(M1 and M2) in byte 19 of its input reports.

Add a probe quirk to detect the controller by string descriptor, expose its
true vendor and product IDs (0x37d7:0x2414) for userspace recognition, and
decode rear paddles in xpad360_process_packet().

Signed-off-by: Hani B <itshanibee@gmail.com>
---
 drivers/input/joystick/xpad.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 2da0b7f1722a..f738a409d139 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -401,6 +401,7 @@ static const struct xpad_device {
 	{ 0x3651, 0x1000, "CRKD SG", 0, XTYPE_XBOX360 },
 	{ 0x366c, 0x0005, "ByoWave Proteus Controller", MAP_SHARE_BUTTON, XTYPE_XBOXONE, FLAG_DELAY_INIT },
 	{ 0x3767, 0x0101, "Fanatec Speedster 3 Forceshock Wheel", 0, XTYPE_XBOX },
+	{ 0x37d7, 0x2414, "Flydigi Direwolf 4", MAP_PADDLES, XTYPE_XBOX360 },
 	{ 0x37d7, 0x2501, "Flydigi Apex 5", 0, XTYPE_XBOX360 },
 	{ 0x413d, 0x2104, "Black Shark Green Ghost Gamepad", 0, XTYPE_XBOX360 },
 	{ 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX },
@@ -938,6 +939,12 @@ static void xpad360_process_packet(struct usb_xpad *xpad, struct input_dev *dev,
 		input_report_abs(dev, ABS_RZ, data[5]);
 	}
 
+	/* paddle handling */
+	if (data[1] >= 20 && (xpad->mapping & MAP_PADDLES)) {
+		input_report_key(dev, BTN_GRIPL, data[19] & BIT(3));
+		input_report_key(dev, BTN_GRIPR, data[19] & BIT(2));
+	}
+
 	input_sync(dev);
 
 	/* XBOX360W controllers can't be turned off without driver assistance */
@@ -1949,6 +1956,12 @@ static int xpad_init_input(struct usb_xpad *xpad)
 		input_dev->id.product = 0x02a1;
 	}
 
+	if (xpad->udev->product && strstr(xpad->udev->product, "Flydigi Direwolf 4")) {
+		/* expose true vendor and product id for Direwolf 4 */
+		input_dev->id.vendor = 0x37d7;
+		input_dev->id.product = 0x2414;
+	}
+
 	input_dev->dev.parent = &xpad->intf->dev;
 
 	input_set_drvdata(input_dev, xpad);
@@ -2085,6 +2098,15 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
 	if (xpad_device[i].flags & FLAG_DELAY_INIT)
 		xpad->delay_init = true;
 
+	/*
+	 * Direwolf 4 enumerates with generic Microsoft Xbox 360 VID/PID
+	 * in PC mode; detect via product string to enable paddles.
+	 */
+	if (udev->product && strstr(udev->product, "Flydigi Direwolf 4")) {
+		xpad->mapping |= MAP_PADDLES;
+		xpad->name = udev->product;
+	}
+
 	xpad->packet_type = PKT_XB;
 	INIT_WORK(&xpad->work, xpad_presence_work);
 
-- 
2.55.0


                 reply	other threads:[~2026-09-03 19:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260903190639.344878-1-itshanibee@gmail.com \
    --to=itshanibee@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --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

all inboxes | Powered by JetHome®