mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH for-next] Input: xpad - add support for Flydigi Direwolf 4 paddles
@ 2026-09-03 19:06 Hani B
  0 siblings, 0 replies; only message in thread
From: Hani B @ 2026-09-03 19:06 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, Hani B

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-03 19:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-03 19:06 [PATCH for-next] Input: xpad - add support for Flydigi Direwolf 4 paddles Hani B

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®