Fix modifier keys for Redragon Asura Keyboard
RFC PATCH 1/1 Fix modifier keys for Redragon Asura Keyboard
The microdia family of keyboards uses a non-standard way of sending modifier keys
The down event always sets the first bit to 0x04 and the second keycode to a custom value For instance, left shift sends the following bits
04 02 00 00 00 00 00 00
while left control sends
04 01 00 00 00 00 00 00
As a result all modifier keys are mapped to left shift and the keyboard is non-functional in that respect. To solve the problem, we capture the raw data in raw_event and manually genereate the correct input events.
I am sending this patch as a RFC to make sure I am taking the correct approach. One functional issue that I'm facing is that the overriden modifier keys also include a KEY_LEFTSHIFT event when pressed. evtest reports the following events when the left control key is pressed:
Event: time 1497521832.320627, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 1
Event: time 1497521832.320627, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e1
Event: time 1497521832.320627, type 1 (EV_KEY), code 42 (KEY_LEFTSHIFT), value 1
Event: time 1497521832.320627, -------------- SYN_REPORT ------------
Event: time 1497521832.384558, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 0
Event: time 1497521832.384558, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e1
Event: time 1497521832.384558, type 1 (EV_KEY), code 42 (KEY_LEFTSHIFT), value 0
Event: time 1497521832.384558, -------------- SYN_REPORT ------------
I would expect the KEY_LEFTSHIFT event to not be sent since I'm returning 1 from microdia_raw_event.
The printk calls will be removed for the final submission.
Tested on Kernel 4.11.4.
--- drivers/hid/Kconfig | 7 +++ drivers/hid/Makefile | 1 + drivers/hid/hid-core.c | 1 + drivers/hid/hid-ids.h | 3 ++ drivers/hid/hid-microdia.c | 121 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 133 insertions(+) create mode 100644 drivers/hid/hid-microdia.c
drivers/hid/Kconfig +7 -0
@@ -521,6 +521,13 @@ config HID_MAYFLASH Say Y here if you have HJZ Mayflash PS3 game controller adapters and want to enable force feedback support. +config HID_MICRODIA + tristate "Microdia based keyboards" + depends on HID + default !EXPERT + ---help--- + Support for Microdia based keyboards such as the Redragon Asura. + config HID_MICROSOFT tristate "Microsoft non-fully HID-compliant devices" depends on HID
drivers/hid/Makefile +1 -0
@@ -59,6 +59,7 @@ obj-$(CONFIG_HID_LOGITECH_DJ) += hid-logitech-dj.o obj-$(CONFIG_HID_LOGITECH_HIDPP) += hid-logitech-hidpp.o obj-$(CONFIG_HID_MAGICMOUSE) += hid-magicmouse.o obj-$(CONFIG_HID_MAYFLASH) += hid-mf.o +obj-$(CONFIG_HID_MICRODIA) += hid-microdia.o obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o obj-$(CONFIG_HID_MONTEREY) += hid-monterey.o obj-$(CONFIG_HID_MULTITOUCH) += hid-multitouch.o
drivers/hid/hid-core.c +1 -0
@@ -1974,6 +1974,7 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD_BOOTLOADER) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_LUXAFOR) }, + { HID_USB_DEVICE(USB_VENDOR_ID_MICRODIA, USB_DEVICE_ID_REDRAGON_ASURA) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_KEYBOARD) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) },
drivers/hid/hid-ids.h +3 -0
@@ -1127,4 +1127,7 @@#define USB_VENDOR_ID_UGTIZER 0x2179#define USB_DEVICE_ID_UGTIZER_TABLET_GP0610 0x0053 +#define USB_VENDOR_ID_MICRODIA 0x0c45 +#define USB_DEVICE_ID_REDRAGON_ASURA 0x760b +#endif
drivers/hid/hid-microdia.c new file +121 -0
121 lines not on this page · raw message
Signature · 1 line
2.13.1