diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2017-07-27 12:32:43 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2017-07-27 14:24:05 +0200 |
commit | 7c388dbd0b2c54b3d836c23ea43e2cee38de66a4 (patch) | |
tree | c14c3ca8d6156143a6a464d8006b3d65585b39d0 /ui/spice-input.c | |
parent | 912092b8e47f31c3db25e088af8460d9e752da29 (diff) | |
download | qemu-7c388dbd0b2c54b3d836c23ea43e2cee38de66a4.zip qemu-7c388dbd0b2c54b3d836c23ea43e2cee38de66a4.tar.gz qemu-7c388dbd0b2c54b3d836c23ea43e2cee38de66a4.tar.bz2 |
ps2: fix sending of PAUSE/BREAK scancodes
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. Rather than trying to handle 3 byte sequences
of scancodes in the PS/2 driver, special case the SPICE input
code so that it captures the 3 byte pause sequence and turns it
into a Pause QKeyCode.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-id: 20170727113243.23991-1-berrange@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/spice-input.c')
-rw-r--r-- | ui/spice-input.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ui/spice-input.c b/ui/spice-input.c index 9185802..cda9976 100644 --- a/ui/spice-input.c +++ b/ui/spice-input.c @@ -32,6 +32,7 @@ typedef struct QemuSpiceKbd { SpiceKbdInstance sin; int ledstate; bool emul0; + size_t pauseseq; } QemuSpiceKbd; static void kbd_push_key(SpiceKbdInstance *sin, uint8_t frag); @@ -64,6 +65,25 @@ static void kbd_push_key(SpiceKbdInstance *sin, uint8_t scancode) keycode |= SCANCODE_GREY; } + if (scancode == SCANCODE_EMUL1) { + kbd->pauseseq++; + return; + } else if (kbd->pauseseq == 1) { + if (keycode == 0x1d) { + kbd->pauseseq++; + return; + } else { + kbd->pauseseq = 0; + } + } else if (kbd->pauseseq == 2) { + if (keycode == 0x45) { + qemu_input_event_send_key_qcode(NULL, Q_KEY_CODE_PAUSE, !up); + kbd->pauseseq = 0; + return; + } + kbd->pauseseq = 0; + } + qemu_input_event_send_key_number(NULL, keycode, !up); } |