Message ID | 20250515190640.15600-1-keenplify@gmail.com |
---|---|
State | New |
Headers | show |
Series | HID: add support for Rakk Dasig X mouse (248a:8266) | expand |
Hi Keenplify, You should run checkpatch.pl on your patch and fix all the issues it points out. On 5/15/25 12:06 PM, keenplify wrote: > 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 --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 Rakk does not have a USB vendor ID. VID 0x248a belongs to Telink. And product ID 0xfa02 is for the Telink Wireless Receiver. You are patching a Telink device, not a Rakk device. It just so happens that Rakk is using Telink chip sets. Many other keyboard and mice vendors may also be using Telink chips. So pretty much everywhere, rakk should be telink. > + > #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 > + }; You can't replace the device's report descriptor, which has keyboard and mouse parts, with a stripped down (and repaired) report descriptor that only has the mouse parts. Any wireless keyboard that uses the Telink Wireless Receiver will stop working. > + > + if (*rsize >= sizeof(fixed_rdesc)) { > + *rsize = sizeof(fixed_rdesc); > + return fixed_rdesc; > + } Just verify the report descriptor is an exact match to the one you captured in size and content. If it matches then fix the one byte that needs fixing in place. Regards, Terry > + > + 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
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