[PULL,5/5] ps2: do not generate invalid key codes for unknown keys
diff mbox

Message ID 1475067272-11714-6-git-send-email-kraxel@redhat.com
State New
Headers show

Commit Message

Gerd Hoffmann Sept. 28, 2016, 12:54 p.m. UTC
From: Hervé Poussineau <hpoussin@reactos.org>

Instead, print a warning message.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Message-id: 1473969987-5890-6-git-send-email-hpoussin@reactos.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/input/ps2.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

Patch
diff mbox

diff --git a/hw/input/ps2.c b/hw/input/ps2.c
index 98da984..0d14de0 100644
--- a/hw/input/ps2.c
+++ b/hw/input/ps2.c
@@ -22,6 +22,7 @@ 
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
+#include "qemu/log.h"
 #include "hw/hw.h"
 #include "hw/input/ps2.h"
 #include "ui/console.h"
@@ -621,7 +622,8 @@  static void ps2_keyboard_event(DeviceState *dev, QemuConsole *src,
                 }
                 ps2_put_keycode(s, keycode & 0xff);
             } else {
-                ps2_queue(&s->common, key->down ? 0x00 : 0x80);
+                qemu_log_mask(LOG_UNIMP,
+                              "ps2: ignoring key with qcode %d\n", qcode);
             }
         }
     } else if (s->scancode_set == 2) {
@@ -660,13 +662,9 @@  static void ps2_keyboard_event(DeviceState *dev, QemuConsole *src,
                     ps2_put_keycode(s, 0xf0);
                 }
                 ps2_put_keycode(s, keycode & 0xff);
-            } else if (key->down) {
-                ps2_queue(&s->common, 0x00);
-            } else if (s->translate) {
-                ps2_queue(&s->common, 0x80);
             } else {
-                ps2_queue(&s->common, 0xf0);
-                ps2_queue(&s->common, 0x00);
+                qemu_log_mask(LOG_UNIMP,
+                              "ps2: ignoring key with qcode %d\n", qcode);
             }
         }
     } else if (s->scancode_set == 3) {
@@ -677,13 +675,9 @@  static void ps2_keyboard_event(DeviceState *dev, QemuConsole *src,
                 ps2_put_keycode(s, 0xf0);
             }
             ps2_put_keycode(s, keycode);
-        } else if (key->down) {
-            ps2_queue(&s->common, 0x00);
-        } else if (s->translate) {
-            ps2_queue(&s->common, 0x80);
         } else {
-            ps2_queue(&s->common, 0xf0);
-            ps2_queue(&s->common, 0x00);
+            qemu_log_mask(LOG_UNIMP,
+                          "ps2: ignoring key with qcode %d\n", qcode);
         }
     }
 }