Skip to contentSkip to conversation

Fix modifier keys for Redragon Asura Keyboard

RFC PATCH New Robert Munteanu 1 participant 1 message Jan 10, 2018 HID

lore
Share & tools
lore
#0 lore raw

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 generate the correct input events.

The keyboard functions mostly as expected now, with only a few minor issues:

- two USB devices are detected instead of 1
- some key combinations are not triggered - e.g.
left shift + left ctrl + p. However, the same combination is recognized with the right shift key.

Tested on Kernel 4.14.12

Changelog:

- v2: modifier keys work, some combinations are still troublesome
- v3: style cleanup, rebase on top of 4.14

---
 drivers/hid/Kconfig        |   9 +++
 drivers/hid/Makefile       |   2 +-
 drivers/hid/hid-core.c     |   3 +
 drivers/hid/hid-ids.h      |   3 +
 drivers/hid/hid-microdia.c | 178 +++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 194 insertions(+), 1 deletion(-)
 create mode 100644 drivers/hid/hid-microdia.c
drivers/hid/Kconfig +9 -0
index 374301fcbc86..0033a81f0ad4 100644
@@ -548,6 +548,15 @@ 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 devices that are not compliant with the HID standard.
+
+    One known example if the Redragon Asura Keyboard.
+
 config HID_MICROSOFT
 	tristate "Microsoft non-fully HID-compliant devices"
 	depends on HID
drivers/hid/Makefile +1 -1
index 235bd2a7b333..e66a305876c5 100644
@@ -62,6 +62,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
@@ -121,4 +122,3 @@ obj-$(CONFIG_USB_KBD)		+= usbhid/
 
 obj-$(CONFIG_I2C_HID)		+= i2c-hid/
 
-obj-$(CONFIG_INTEL_ISH_HID)	+= intel-ish-hid/
drivers/hid/hid-core.c +3 -0
index 330ca983828b..eeb325e3ff0d 100644
@@ -2388,6 +2388,9 @@ static const struct hid_device_id hid_have_special_driver[] = {
 #endif
 #if IS_ENABLED(CONFIG_HID_ZYDACRON)
 	{ HID_USB_DEVICE(USB_VENDOR_ID_ZYDACRON, USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL) },
+#endif
+#if IS_ENABLED(CONFIG_HID_MICRODIA)
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICRODIA,  USB_DEVICE_ID_REDRAGON_ASURA) },
 #endif
 	{ }
 };
drivers/hid/hid-ids.h +3 -0
index be2e005c3c51..2edbf01361f1 100644
@@ -1161,4 +1161,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 +178 -0

178 lines not on this page · raw message

Signature · 1 line
2.15.1