]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
HID: rakk: add support for Rakk Dasig X side buttons
authorKarl Cayme <kcayme@gmail.com>
Sat, 21 Mar 2026 12:42:49 +0000 (20:42 +0800)
committerJiri Kosina <jkosina@suse.com>
Tue, 12 May 2026 15:28:52 +0000 (17:28 +0200)
The Rakk Dasig X gaming mouse has a faulty HID report descriptor that
declares USAGE_MAXIMUM=3 (buttons 1-3) while actually sending 5 button
bits (REPORT_COUNT=5). This causes the kernel to ignore side buttons
(buttons 4 and 5).

Fix by patching the descriptor to set USAGE_MAXIMUM=5 in the
report_fixup callback.

The mouse uses Telink vendor ID 0x248a with three product IDs for USB
direct (0xfb01), wireless dongle (0xfa02), and Bluetooth (0x8266)
connection modes. All three variants have the same bug at byte offset 17.

Suggested-by: Terry Junge <linuxhid@cosmicgizmosystems.com>
Signed-off-by: Karl Cayme <kcayme@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
drivers/hid/Kconfig
drivers/hid/Makefile
drivers/hid/hid-ids.h
drivers/hid/hid-rakk.c [new file with mode: 0644]

index ff2f580b660ba62d3d34a9a37629a31ca9eb90b4..0fdb794cea24dff1cc854d077ff7b8b96a2bc796 100644 (file)
@@ -766,6 +766,15 @@ config HID_MEGAWORLD_FF
        Say Y here if you have a Mega World based game controller and want
        to have force feedback support for it.
 
+config HID_RAKK
+       tristate "Rakk support"
+       help
+         Support for Rakk gaming peripherals.
+
+         Fixes the HID report descriptor of the Rakk Dasig X mouse,
+         which declares USAGE_MAXIMUM=3 (buttons 1-3) while actually
+         sending 5 button bits. This causes side buttons to be ignored.
+
 config HID_REDRAGON
        tristate "Redragon keyboards"
        help
index 0597fd6a4ffd32e8a7e1565af21f2802a6c869c7..dd7ba9db01ae4e608e59dfdb07dfd2033ee472dd 100644 (file)
@@ -115,6 +115,7 @@ obj-$(CONFIG_HID_PLANTRONICS)       += hid-plantronics.o
 obj-$(CONFIG_HID_PLAYSTATION)  += hid-playstation.o
 obj-$(CONFIG_HID_PRIMAX)       += hid-primax.o
 obj-$(CONFIG_HID_PXRC)         += hid-pxrc.o
+obj-$(CONFIG_HID_RAKK)         += hid-rakk.o
 obj-$(CONFIG_HID_RAPOO) += hid-rapoo.o
 obj-$(CONFIG_HID_RAZER)        += hid-razer.o
 obj-$(CONFIG_HID_REDRAGON)     += hid-redragon.o
index 0cf63742315bf8615eab8e7fc0dca24a75ee846f..847889d63276ca9ca6e491f28b249dc1e9b0e757 100644 (file)
 #define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_017       0x73f6
 #define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5   0x81a7
 
+#define USB_VENDOR_ID_TELINK                           0x248a
+#define USB_DEVICE_ID_TELINK_RAKK_DASIG_X              0xfb01
+#define USB_DEVICE_ID_TELINK_RAKK_DASIG_X_DONGLE       0xfa02
+#define USB_DEVICE_ID_TELINK_RAKK_DASIG_X_BT           0x8266
+
 #define USB_VENDOR_ID_TEXAS_INSTRUMENTS        0x2047
 #define USB_DEVICE_ID_TEXAS_INSTRUMENTS_LENOVO_YOGA    0x0855
 
diff --git a/drivers/hid/hid-rakk.c b/drivers/hid/hid-rakk.c
new file mode 100644 (file)
index 0000000..1140058
--- /dev/null
@@ -0,0 +1,75 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ *  HID driver for Rakk devices
+ *
+ *  Copyright (c) 2026 Karl Cayme
+ *
+ *  The Rakk Dasig X gaming mouse has a faulty HID report descriptor that
+ *  declares USAGE_MAXIMUM = 3 (buttons 1-3) while actually sending 5 button
+ *  bits (REPORT_COUNT = 5). This causes the kernel to ignore side buttons
+ *  (buttons 4 and 5). This driver fixes the descriptor so all 5 buttons
+ *  are properly recognized across 3 modes (wired, dongle, and Bluetooth).
+ */
+
+#include <linux/device.h>
+#include <linux/hid.h>
+#include <linux/module.h>
+#include "hid-ids.h"
+
+/*
+ * The faulty byte is at offset 17 in the report descriptor for all three
+ * connection modes (USB direct, wireless dongle, and Bluetooth).
+ *
+ * Bytes 16-17 are: 0x29 0x03 (USAGE_MAXIMUM = 3)
+ * The fix changes byte 17 to 0x05 (USAGE_MAXIMUM = 5).
+ *
+ * Original descriptor bytes 0-17:
+ *   05 01 09 02 a1 01 85 01 09 01 a1 00 05 09 19 01 29 03
+ *                                                       ^^
+ *   Should be 0x05 to declare 5 buttons instead of 3.
+ */
+#define RAKK_RDESC_USAGE_MAX_OFFSET    17
+#define RAKK_RDESC_USAGE_MAX_ORIG      0x03
+#define RAKK_RDESC_USAGE_MAX_FIXED     0x05
+#define RAKK_RDESC_USB_SIZE            193
+#define RAKK_RDESC_DONGLE_SIZE         150
+#define RAKK_RDESC_BT_SIZE             89
+
+static const __u8 *rakk_report_fixup(struct hid_device *hdev, __u8 *rdesc,
+                                    unsigned int *rsize)
+{
+       if (((*rsize == RAKK_RDESC_USB_SIZE &&
+             hdev->product == USB_DEVICE_ID_TELINK_RAKK_DASIG_X) ||
+            (*rsize == RAKK_RDESC_DONGLE_SIZE &&
+             hdev->product == USB_DEVICE_ID_TELINK_RAKK_DASIG_X_DONGLE) ||
+            (*rsize == RAKK_RDESC_BT_SIZE &&
+             hdev->product == USB_DEVICE_ID_TELINK_RAKK_DASIG_X_BT)) &&
+           rdesc[RAKK_RDESC_USAGE_MAX_OFFSET] == RAKK_RDESC_USAGE_MAX_ORIG) {
+               hid_info(hdev, "fixing Rakk Dasig X button count (3 -> 5)\n");
+               rdesc[RAKK_RDESC_USAGE_MAX_OFFSET] = RAKK_RDESC_USAGE_MAX_FIXED;
+       }
+
+       return rdesc;
+}
+
+static const struct hid_device_id rakk_devices[] = {
+       { HID_USB_DEVICE(USB_VENDOR_ID_TELINK,
+                        USB_DEVICE_ID_TELINK_RAKK_DASIG_X) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_TELINK,
+                        USB_DEVICE_ID_TELINK_RAKK_DASIG_X_DONGLE) },
+       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TELINK,
+                              USB_DEVICE_ID_TELINK_RAKK_DASIG_X_BT) },
+       { }
+};
+MODULE_DEVICE_TABLE(hid, rakk_devices);
+
+static struct hid_driver rakk_driver = {
+       .name = "rakk",
+       .id_table = rakk_devices,
+       .report_fixup = rakk_report_fixup,
+};
+module_hid_driver(rakk_driver);
+
+MODULE_DESCRIPTION("HID driver for Rakk Dasig X mouse - fix side button support");
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Karl Cayme");