Last active
March 27, 2019 14:20
-
-
Save YangKeao/1f5a27de16003343f7b23b1a795abb33 to your computer and use it in GitHub Desktop.
usbkbd.diff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From b190103978a60cca75ccf846cf082a00b1eb6f8c Mon Sep 17 00:00:00 2001 | |
From: Yang Keao <[email protected]> | |
Date: Wed, 27 Mar 2019 21:12:17 +0800 | |
Subject: [PATCH] Modify USBKBD | |
--- | |
drivers/hid/usbhid/usbkbd.c | 12 ++++++++++++ | |
1 file changed, 12 insertions(+) | |
diff --git a/drivers/hid/usbhid/usbkbd.c b/drivers/hid/usbhid/usbkbd.c | |
index ed01dc42..049a8dff 100644 | |
--- a/drivers/hid/usbhid/usbkbd.c | |
+++ b/drivers/hid/usbhid/usbkbd.c | |
@@ -126,6 +126,18 @@ static void usb_kbd_irq(struct urb *urb) | |
goto resubmit; | |
} | |
+ static const unsigned char hjkl_map[4] = {11, 13, 14, 15}; | |
+ static const unsigned char arrow_key_map[4] = {80, 81, 82, 79}; | |
+ if (kbd->new[0] == 4) { | |
+ for(i=0;i<4;i++) { | |
+ unsigned char* key = memscan(kbd->new + 2, hjkl_map[i], 6); | |
+ if(key != kbd->new + 8) { | |
+ *key = arrow_key_map[i]; | |
+ kbd->new[0] = 0; | |
+ } | |
+ } | |
+ } | |
+ | |
for (i = 0; i < 8; i++) | |
input_report_key(kbd->dev, usb_kbd_keycode[i + 224], (kbd->new[0] >> i) & 1); | |
-- | |
2.19.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment