[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[win-pv-devel] [PATCH xenvkbd] Fix a couple of key mappings...



...which gets CTRL+ALT+DEL working

This patch also adds some helpful debug code.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 src/xenvkbd/ring.c | 25 ++++++++++++++++++++++++-
 src/xenvkbd/vkbd.h |  3 ++-
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/src/xenvkbd/ring.c b/src/xenvkbd/ring.c
index 25d97ec..bd9dc53 100644
--- a/src/xenvkbd/ring.c
+++ b/src/xenvkbd/ring.c
@@ -189,12 +189,13 @@ SetArray(
 }
 
 struct _KEY_CODE_TO_USAGE {
+    const CHAR  *KeyName;
     UCHAR       KeyCode;
     USHORT      Usage;
 };
 
 #define DEFINE_USAGE(_KeyCode, _Usage) \
-    { _KeyCode, _Usage }
+    { #_KeyCode, _KeyCode, _Usage }
 
 static struct _KEY_CODE_TO_USAGE KeyCodeToUsageTable[] = {
     DEFINE_USAGE_TABLE
@@ -217,6 +218,23 @@ static VOID RingBuildKeyCodeToUsageMapping(
     }
 }
 
+static FORCEINLINE const CHAR *
+__KeyCodeToKeyName(
+    ULONG   KeyCode
+    )
+{
+    ULONG   Index;
+
+    for (Index = 0; Index < ARRAYSIZE(KeyCodeToUsageTable); Index++) {
+        struct _KEY_CODE_TO_USAGE   *Entry = &KeyCodeToUsageTable[Index];
+
+        if (Entry->KeyCode == KeyCode)
+            return Entry->KeyName;
+    }
+
+    return "UNKNOWN";
+}
+
 static FORCEINLINE USHORT
 __RingKeyCodeToUsage(
     IN  PXENVKBD_RING   Ring,
@@ -266,6 +284,11 @@ __RingEventKeypress(
     } else {
         // map KeyCode to Usage
         USHORT  Usage = __RingKeyCodeToUsage(Ring, KeyCode);
+
+        Trace("%s (%02x) -> %04x (%s)\n",
+              __KeyCodeToKeyName(KeyCode), KeyCode,
+              Usage, Pressed ? "PRESSED" : "RELEASED");
+
         if (Usage == 0)
             return; // non-standard key
 
diff --git a/src/xenvkbd/vkbd.h b/src/xenvkbd/vkbd.h
index d8b2725..fa4cd7f 100644
--- a/src/xenvkbd/vkbd.h
+++ b/src/xenvkbd/vkbd.h
@@ -228,6 +228,7 @@ static const HID_DEVICE_ATTRIBUTES VkbdDeviceAttributes = {
     DEFINE_USAGE(KEY_RIGHTCTRL, 0xE4),          \
     DEFINE_USAGE(KEY_KPSLASH, 0x54),            \
     DEFINE_USAGE(KEY_SYSRQ, 0x48),              \
+    DEFINE_USAGE(KEY_PAUSE, 0x48),              \
     DEFINE_USAGE(KEY_RIGHTALT, 0xE6),           \
     DEFINE_USAGE(KEY_HOME, 0x4A),               \
     DEFINE_USAGE(KEY_UP, 0x52),                 \
@@ -238,7 +239,7 @@ static const HID_DEVICE_ATTRIBUTES VkbdDeviceAttributes = {
     DEFINE_USAGE(KEY_DOWN, 0x51),               \
     DEFINE_USAGE(KEY_PAGEDOWN, 0x4E),           \
     DEFINE_USAGE(KEY_INSERT, 0x49),             \
-    DEFINE_USAGE(KEY_DELETE, 0x4D),             \
+    DEFINE_USAGE(KEY_DELETE, 0x4C),             \
     DEFINE_USAGE(KEY_MUTE, 0x7F),               \
     DEFINE_USAGE(KEY_VOLUMEDOWN, 0x81),         \
     DEFINE_USAGE(KEY_VOLUMEUP, 0x80),           \
-- 
2.5.3


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/win-pv-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.