usb: Key codes for Microsoft Natural Ergonomic 4000 USB keyboard
Subsystems (2)
PATCH 1/1 usb: Key codes for Microsoft Natural Ergonomic 4000 USB keyboard
From: John Zaitseff <[email protected]>
The following patch to Linux kernel 2.6.16-rc5 enables the extra keys found on the Microsoft Natural Ergonomic 4000 USB keyboard. I had to add a number of keycodes to include/linux/input.h; feel free to reallocate IDs assigned to these new keys.
Main changes:
* Enabled the use of the extra "(" and ")" in the top right-hand part of the keyboard, above the keypad
* Map the zoom slider to KEY_ZOOMPLUS and KEY_ZOOMMINUS (they are actually keypresses)
* Map the F1-F12 keys to appropriate keys when the F Lock is off (this is quite easy as the keyboard already generates different USB key events)
* Map the five buttons above My Favorites to KEY_FN_F1 to KEY_FN_F5
I am not sure that I have done the last of these changes correctly:
the keyboard returns a usage->hid of (HID_UP_MSVENDOR | 0xff05) whenever any of the five keys are pressed or let go (as well as at certain other times, when the value is 0):
value = 0x00 ---> none of the five keys are pressed value = 0x01 ---> key 1 is pressed value = 0x02 ---> key 2 is pressed value = 0x04 ---> key 3 is pressed value = 0x08 ---> key 4 is pressed value = 0x10 ---> key 5 is pressed
Note that although this looks like a bitfield, multiple keys CANNOT in effect be pressed simultaneously: only one of these six values is ever returned (as tested).
Please apply if at all possible! Please CC me on any discussion, as I am not subscribed to the mailing lists.
---
drivers/usb/input/hid-debug.h | 7 +++--- drivers/usb/input/hid-input.c | 45 +++++++++++++++++++++++++++++++++++++++--- drivers/usb/input/usbkbd.c | 2 - include/linux/input.h | 3 ++ 4 files changed, 50 insertions(+), 7 deletions(-)
drivers/usb/input/hid-debug.h +4 -3
@@ -675,9 +675,10 @@ static char *keys[KEY_MAX + 1] = { [KEY_SLOW] = "Slow", [KEY_SHUFFLE] = "Shuffle", [KEY_BREAK] = "Break", [KEY_PREVIOUS] = "Previous", [KEY_DIGITS] = "Digits", [KEY_TEEN] = "TEEN", - [KEY_TWEN] = "TWEN", [KEY_DEL_EOL] = "DeleteEOL", - [KEY_DEL_EOS] = "DeleteEOS", [KEY_INS_LINE] = "InsertLine", - [KEY_DEL_LINE] = "DeleteLine", + [KEY_TWEN] = "TWEN", [KEY_ZOOMPLUS] = "ZoomPlus", + [KEY_ZOOMMINUS] = "ZoomMinus", [KEY_SPELL] = "Spell", + [KEY_DEL_EOL] = "DeleteEOL", [KEY_DEL_EOS] = "DeleteEOS", + [KEY_INS_LINE] = "InsertLine", [KEY_DEL_LINE] = "DeleteLine", [KEY_SEND] = "Send", [KEY_REPLY] = "Reply", [KEY_FORWARDMAIL] = "ForwardMail", [KEY_SAVE] = "Save", [KEY_DOCUMENTS] = "Documents",
drivers/usb/input/hid-input.c +42 -3
81 lines not on this page · raw message
drivers/usb/input/usbkbd.c +1 -1
@@ -58,7 +58,7 @@ static unsigned char usb_kbd_keycode[256115 ,114 ,0 ,0 ,0 ,121 ,0 ,89 ,93 ,124 ,92 ,94 ,95 ,0 ,0 ,0 ,122 ,123 ,90 ,91 ,85 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , -0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , +0 ,0 ,0 ,0 ,0 ,0 ,179 ,180 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , 29, 42, 56,125, 97, 54,100,126,164,166,165,163,161,115,114,113,
include/linux/input.h +3 -0
@@ -484,6 +484,9 @@ struct input_absinfo {#define KEY_DIGITS 0x19d#define KEY_TEEN 0x19e#define KEY_TWEN 0x19f +#define KEY_ZOOMPLUS 0x1a0 +#define KEY_ZOOMMINUS 0x1a1 +#define KEY_SPELL 0x1a2#define KEY_DEL_EOL 0x1c0#define KEY_DEL_EOS 0x1c1
Signature · 5 lines
John Zaitseff ,--_|\ The ZAP Group Phone: +61 2 9643 7737 / \ Sydney, Australia E-mail: [email protected] \_,--._* http://www.zap.org.au/ Finger: [email protected] v GnuPG fingerprint: 8FD2 8962 7768 2546 FE07 DE7C 61A8 4486 C9A6 69B0