qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for 2.10] ps2: fix sending of PAUSE/BREAK scancodes
@ 2017-07-24 16:46 Daniel P. Berrange
  2017-07-24 19:55 ` Hervé Poussineau
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel P. Berrange @ 2017-07-24 16:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Hervé Poussineau, Daniel P. Berrange

The processing of the scancodes for PAUSE/BREAK  has been broken since
the conversion to qcodes in:

  commit 8c10e0baf0260b59a4e984744462a18016662e3e
  Author: Hervé Poussineau <hpoussin@reactos.org>
  Date:   Thu Sep 15 22:06:26 2016 +0200

    ps2: use QEMU qcodes instead of scancodes

When using a VNC client, with the raw scancode extension, the client
will send a scancode of 0xc6 for both PAUSE and BREAK. There is mistakenly
no entry in the qcode_to_number table for this scancode, so
ps2_keyboard_event() just generates a log message and discards the
scancode

When using a SPICE client, it will also send 0xc6 for BREAK, but
will send 0xe1 0x1d 0x45 0xe1 0x9d 0xc5 for PAUSE. There is no
entry in the qcode_to_number table for the scancode 0xe1 because
it is a special XT keyboard prefix not mapping to any QKeyCode.
Again ps2_keyboard_event() just generates a log message and discards
the scancode. The following 0x1d, 0x45, 0x9d, 0xc5 scancodes get
handled correctly. Fixing this just requires special casing 0xe1 so
it is directly queued for sending to the guest, skipping any conversion
to QKeyCode.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
 hw/input/ps2.c    | 7 +++++++
 ui/input-keymap.c | 1 +
 2 files changed, 8 insertions(+)

diff --git a/hw/input/ps2.c b/hw/input/ps2.c
index 3ba05efd06..a132d1ba72 100644
--- a/hw/input/ps2.c
+++ b/hw/input/ps2.c
@@ -607,6 +607,13 @@ static void ps2_keyboard_event(DeviceState *dev, QemuConsole *src,
     assert(evt->type == INPUT_EVENT_KIND_KEY);
     qcode = qemu_input_key_value_to_qcode(key->key);
 
+    if (qcode == 0 &&
+        key->key->type == KEY_VALUE_KIND_NUMBER &&
+        key->key->u.number.data == 0x61) {
+        ps2_put_keycode(s, 0xe1);
+        return;
+    }
+
     if (s->scancode_set == 1) {
         if (qcode == Q_KEY_CODE_PAUSE) {
             if (key->down) {
diff --git a/ui/input-keymap.c b/ui/input-keymap.c
index 8a1476fc48..9211f835be 100644
--- a/ui/input-keymap.c
+++ b/ui/input-keymap.c
@@ -98,6 +98,7 @@ static const int qcode_to_number[] = {
     [Q_KEY_CODE_KP_ENTER] = 0x9c,
     [Q_KEY_CODE_KP_DECIMAL] = 0x53,
     [Q_KEY_CODE_SYSRQ] = 0x54,
+    [Q_KEY_CODE_PAUSE] = 0xc6,
 
     [Q_KEY_CODE_KP_0] = 0x52,
     [Q_KEY_CODE_KP_1] = 0x4f,
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-07-27  9:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-24 16:46 [Qemu-devel] [PATCH for 2.10] ps2: fix sending of PAUSE/BREAK scancodes Daniel P. Berrange
2017-07-24 19:55 ` Hervé Poussineau
2017-07-25  8:32   ` Daniel P. Berrange
2017-07-25 11:53     ` Gerd Hoffmann
2017-07-26 11:28       ` Daniel P. Berrange
2017-07-26 11:44         ` Gerd Hoffmann
2017-07-26 12:05           ` Daniel P. Berrange
2017-07-26 12:33             ` Gerd Hoffmann
2017-07-26 12:45               ` Daniel P. Berrange
2017-07-27  9:50                 ` Daniel P. Berrange

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).