diff mbox series

HID: add support for Rakk Dasig X mouse (248a:8266)

Message ID 20250515190640.15600-1-keenplify@gmail.com
State New
Headers show
Series HID: add support for Rakk Dasig X mouse (248a:8266) | expand

Commit Message

keenplify May 15, 2025, 7:06 p.m. UTC
This adds a HID quirk driver for the Rakk Dasig X gaming mouse
to expose the side buttons properly via evdev. The default report
descriptor does not expose all inputs, so this driver replaces
it with a fixed descriptor.

Reported-by: Keenplify <keenplify@gmail.com>
Tested-by: Keenplify <keenplify@gmail.com>
Signed-off-by: Keenplify <keenplify@gmail.com>
Signed-off-by: keenplify <keenplify@gmail.com>
---
 drivers/hid/Kconfig    |  6 ++++++
 drivers/hid/Makefile   |  1 +
 drivers/hid/hid-ids.h  |  3 +++
 drivers/hid/hid-rakk.c | 45 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 55 insertions(+)
 create mode 100644 drivers/hid/hid-rakk.c
diff mbox series

Patch

diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index a503252702b7..a2cf200e841b 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -1413,6 +1413,12 @@  config HID_KUNIT_TEST
 
 	  If in doubt, say "N".
 
+config HID_RAKK
+	tristate "RAKK HID driver"
+	depends on HID
+	help
+		Support for the RAKK HID device.
+
 endmenu
 
 source "drivers/hid/bpf/Kconfig"
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 10ae5dedbd84..4ece64ebf2ec 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -113,6 +113,7 @@  obj-$(CONFIG_HID_PLAYSTATION)	+= hid-playstation.o
 obj-$(CONFIG_HID_PRIMAX)	+= hid-primax.o
 obj-$(CONFIG_HID_PXRC)		+= hid-pxrc.o
 obj-$(CONFIG_HID_RAZER)	+= hid-razer.o
+obj-$(CONFIG_HID_RAKK)		+= hid-rakk.o
 obj-$(CONFIG_HID_REDRAGON)	+= hid-redragon.o
 obj-$(CONFIG_HID_RETRODE)	+= hid-retrode.o
 obj-$(CONFIG_HID_ROCCAT)	+= hid-roccat.o hid-roccat-common.o \
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 288a2b864cc4..a052a307fdda 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -1520,4 +1520,7 @@ 
 #define USB_VENDOR_ID_SIGNOTEC			0x2133
 #define USB_DEVICE_ID_SIGNOTEC_VIEWSONIC_PD1011	0x0018
 
+#define USB_VENDOR_ID_RAKK        0x248a
+#define USB_DEVICE_ID_RAKK_DASIGX 0xfa02
+
 #endif
diff --git a/drivers/hid/hid-rakk.c b/drivers/hid/hid-rakk.c
new file mode 100644
index 000000000000..38abf92e764a
--- /dev/null
+++ b/drivers/hid/hid-rakk.c
@@ -0,0 +1,45 @@ 
+#include <linux/module.h>
+#include <linux/hid.h>
+
+#include "hid-ids.h"
+
+static const __u8 *rakk_report_fixup(struct hid_device *hdev, __u8 *rdesc,
+                                     unsigned int *rsize)
+
+{
+    static __u8 fixed_rdesc[] = {
+        0x05, 0x01, 0x09, 0x02, 0xa1, 0x01, 0x85, 0x01,
+        0x09, 0x01, 0xa1, 0x00, 0x05, 0x09, 0x19, 0x01,
+        0x29, 0x05,
+        0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x05,
+        0x81, 0x02, 0x75, 0x03, 0x95, 0x01, 0x81, 0x01,
+        0x05, 0x01, 0x09, 0x30, 0x09, 0x31, 0x16, 0x01,
+        0x80, 0x26, 0xff, 0x7f, 0x75, 0x10, 0x95, 0x02,
+        0x81, 0x06, 0x09, 0x38, 0x15, 0x81, 0x25, 0x7f,
+        0x75, 0x08, 0x95, 0x01, 0x81, 0x06, 0xc0, 0xc0
+    };
+
+    if (*rsize >= sizeof(fixed_rdesc)) {
+        *rsize = sizeof(fixed_rdesc);
+        return fixed_rdesc;
+    }
+
+    return rdesc;
+}
+
+static const struct hid_device_id rakk_devices[] = {
+    { HID_USB_DEVICE(USB_VENDOR_ID_RAKK, USB_DEVICE_ID_RAKK_DASIGX) },
+    { }
+};
+MODULE_DEVICE_TABLE(hid, rakk_devices);
+
+static struct hid_driver rakk_driver = {
+    .name = "hid-rakk",
+    .id_table = rakk_devices,
+    .report_fixup = rakk_report_fixup,
+};
+module_hid_driver(rakk_driver);
+
+MODULE_AUTHOR("keenplify");
+MODULE_DESCRIPTION("Fix for Rakk Dasig X side buttons");
+MODULE_LICENSE("GPL");
\ No newline at end of file