Author: rharabien
Date: Mon Mar 5 17:07:15 2012
New Revision: 56037
URL:
http://svn.reactos.org/svn/reactos?rev=56037&view=rev
Log:
[KBDHID][HIDPARSER]
- Fix extended keys (scan-codes prefixed with E0) translation. Fixes Win-key.
Modified:
trunk/reactos/drivers/hid/kbdhid/kbdhid.c
trunk/reactos/lib/drivers/hidparser/api.c
Modified: trunk/reactos/drivers/hid/kbdhid/kbdhid.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/hid/kbdhid/kbdhid.…
==============================================================================
--- trunk/reactos/drivers/hid/kbdhid/kbdhid.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/hid/kbdhid/kbdhid.c [iso-8859-1] Mon Mar 5 17:07:15 2012
@@ -45,6 +45,7 @@
KEYBOARD_INPUT_DATA InputData;
ULONG Index;
PKBDHID_DEVICE_EXTENSION DeviceExtension;
+ CHAR Prefix = 0;
/* get device extension */
DeviceExtension = (PKBDHID_DEVICE_EXTENSION)Context;
@@ -52,6 +53,13 @@
for(Index = 0; Index < Length; Index++)
{
DPRINT("[KBDHID] ScanCode Index %lu ScanCode %x\n", Index,
NewScanCodes[Index] & 0xFF);
+
+ /* check if this is E0 or E1 prefix */
+ if (NewScanCodes[Index] == (CHAR)0xE0 || NewScanCodes[Index] == (CHAR)0xE1)
+ {
+ Prefix = NewScanCodes[Index];
+ continue;
+ }
/* init input data */
RtlZeroMemory(&InputData, sizeof(KEYBOARD_INPUT_DATA));
@@ -59,14 +67,21 @@
/* use keyboard unit id */
InputData.UnitId = DeviceExtension->KeyboardTypematic.UnitId;
- if (((UCHAR)(NewScanCodes[Index] & 0xFF))> 0x7F)
+ if (NewScanCodes[Index] & 0x80)
{
- /* scan codes greater than 0x7F are a key break */
+ /* scan codes with 0x80 flag are a key break */
InputData.Flags |= KEY_BREAK;
}
+ /* set a prefix if needed */
+ if (Prefix)
+ {
+ InputData.Flags |= (Prefix == (CHAR)0xE0 ? KEY_E0 : KEY_E1);
+ Prefix = 0;
+ }
+
/* store key code */
- InputData.MakeCode = NewScanCodes[Index];
+ InputData.MakeCode = NewScanCodes[Index] & 0x7F;
/* dispatch scan codes */
KbdHid_DispatchInputData((PKBDHID_DEVICE_EXTENSION)Context, &InputData);
Modified: trunk/reactos/lib/drivers/hidparser/api.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/hidparser/api.…
==============================================================================
--- trunk/reactos/lib/drivers/hidparser/api.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/hidparser/api.c [iso-8859-1] Mon Mar 5 17:07:15 2012
@@ -12,26 +12,26 @@
#include "parser.h"
static ULONG KeyboardScanCodes[256] =
-{
- 0x0000, 0x0000, 0x0000, 0x0000, 0x001e, 0x0030, 0x002e, 0x0020, 0x0012, 0x0021,
0x0022, 0x0023, 0x0017, 0x0024, 0x0025, 0x0026,
- 0x0032, 0x0031, 0x0018, 0x0019, 0x0010, 0x0013, 0x001f, 0x0014, 0x0016, 0x002f,
0x0011, 0x002d, 0x0015, 0x002c, 0x0002, 0x0003,
- 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x001c, 0x0001,
0x000e, 0x000f, 0x0039, 0x000c, 0x000d, 0x001a,
- 0x001b, 0x002b, 0x002b, 0x0027, 0x0028, 0x0029, 0x0033, 0x0034, 0x0035, 0x003a,
0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0x0040,
- 0x0041, 0x0042, 0x0043, 0x0044, 0x0057, 0x0058, 0x0063, 0x0046, 0x0077, 0xE052,
0xE047, 0xE049, 0xE053, 0xE04F, 0xE051, 0xE04D,
- 0xE04B, 0xE050, 0xE048, 0x0045, 0xE035, 0x0037, 0x004a, 0x004e, 0xE01C, 0x004f,
0x0050, 0x0051, 0x004b, 0x004c, 0x004d, 0x0047,
- 0x0048, 0x0049, 0x0052, 0x0053, 0x0056, 0xE05D, 0xE05E, 0x0075, 0x00b7, 0x00b8,
0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be,
- 0x00bf, 0x00c0, 0x00c1, 0x00c2, 0x0086, 0x008a, 0x0082, 0x0084, 0x0080, 0x0081,
0x0083, 0x0089, 0x0085, 0x0087, 0x0088, 0x0071,
- 0x0073, 0x0072, 0x0000, 0x0000, 0x0000, 0x0079, 0x0000, 0x0059, 0x005d, 0x007c,
0x005c, 0x005e, 0x005f, 0x0000, 0x0000, 0x0000,
- 0x007a, 0x007b, 0x005a, 0x005b, 0x0055, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x001D, 0x002A, 0x0038, 0xE05B, 0xE01D, 0x0036, 0xE038, 0xE05C, 0x00a4, 0x00a6,
0x00a5, 0x00a3, 0x00a1, 0x0073, 0x0072, 0x0071,
- 0x0096, 0x009e, 0x009f, 0x0080, 0x0088, 0x00b1, 0x00b2, 0x00b0, 0x008e, 0x0098,
0x00ad, 0x008c, 0x0000, 0x0000, 0x0000, 0x0000,
+{ /* 0 1 2 3 4 5 6 7 8 9 A
B C D E F */
+/* 0 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x001e, 0x0030, 0x002e, 0x0020, 0x0012, 0x0021,
0x0022, 0x0023, 0x0017, 0x0024, 0x0025, 0x0026,
+/* 1 */ 0x0032, 0x0031, 0x0018, 0x0019, 0x0010, 0x0013, 0x001f, 0x0014, 0x0016, 0x002f,
0x0011, 0x002d, 0x0015, 0x002c, 0x0002, 0x0003,
+/* 2 */ 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x001c, 0x0001,
0x000e, 0x000f, 0x0039, 0x000c, 0x000d, 0x001a,
+/* 3 */ 0x001b, 0x002b, 0x002b, 0x0027, 0x0028, 0x0029, 0x0033, 0x0034, 0x0035, 0x003a,
0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0x0040,
+/* 4 */ 0x0041, 0x0042, 0x0043, 0x0044, 0x0057, 0x0058, 0x0063, 0x0046, 0x0077, 0xE052,
0xE047, 0xE049, 0xE053, 0xE04F, 0xE051, 0xE04D,
+/* 5 */ 0xE04B, 0xE050, 0xE048, 0x0045, 0xE035, 0x0037, 0x004a, 0x004e, 0xE01C, 0x004f,
0x0050, 0x0051, 0x004b, 0x004c, 0x004d, 0x0047,
+/* 6 */ 0x0048, 0x0049, 0x0052, 0x0053, 0x0056, 0xE05D, 0xE05E, 0x0075, 0x00b7, 0x00b8,
0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be,
+/* 7 */ 0x00bf, 0x00c0, 0x00c1, 0x00c2, 0x0086, 0x008a, 0x0082, 0x0084, 0x0080, 0x0081,
0x0083, 0x0089, 0x0085, 0x0087, 0x0088, 0x0071,
+/* 8 */ 0x0073, 0x0072, 0x0000, 0x0000, 0x0000, 0x0079, 0x0000, 0x0059, 0x005d, 0x007c,
0x005c, 0x005e, 0x005f, 0x0000, 0x0000, 0x0000,
+/* 9 */ 0x007a, 0x007b, 0x005a, 0x005b, 0x0055, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+/* A */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+/* B */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+/* C */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+/* D */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+/* E */ 0x001D, 0x002A, 0x0038, 0xE05B, 0xE01D, 0x0036, 0xE038, 0xE05C, 0x00a4, 0x00a6,
0x00a5, 0x00a3, 0x00a1, 0x0073, 0x0072, 0x0071,
+/* F */ 0x0096, 0x009e, 0x009f, 0x0080, 0x0088, 0x00b1, 0x00b2, 0x00b0, 0x008e, 0x0098,
0x00ad, 0x008c, 0x0000, 0x0000, 0x0000, 0x0000,
};
-//#define NTOHS(n) (((((unsigned short)(n) & 0xFF)) << 8) | (((unsigned
short)(n) & 0xFF00) >> 8))
+#define NTOHS(n) (((((unsigned short)(n) & 0xFF)) << 8) | (((unsigned short)(n)
& 0xFF00) >> 8))
HIDPARSER_STATUS
HidParser_GetCollectionUsagePage(
@@ -737,7 +737,6 @@
return HIDPARSER_STATUS_I8042_TRANS_UNKNOWN;
}
-#if 0
if ((ScanCode & 0xE000) == 0xE000)
{
//
@@ -745,7 +744,6 @@
//
ScanCode = NTOHS(ScanCode);
}
-#endif
//
// FIXME: translate modifier states