* [Qemu-devel] [PATCH v3] ps2: fix sending of PAUSE/BREAK scancodes
@ 2017-07-27 14:11 Daniel P. Berrange
2017-07-27 15:48 ` Gerd Hoffmann
0 siblings, 1 reply; 3+ messages in thread
From: Daniel P. Berrange @ 2017-07-27 14:11 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. 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>
---
Changed in v3:
- Treat entire '0xe1 0x1d 0x45 0xe1 0x9d 0xc5' as make code,
there is no break code for PAUSE.
ui/input-keymap.c | 1 +
ui/spice-input.c | 14 ++++++++++++++
2 files changed, 15 insertions(+)
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,
diff --git a/ui/spice-input.c b/ui/spice-input.c
index 918580239d..3d41aa1831 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);
@@ -49,6 +50,7 @@ static const SpiceKbdInterface kbd_interface = {
static void kbd_push_key(SpiceKbdInstance *sin, uint8_t scancode)
{
+ static const uint8_t pauseseq[] = { 0xe1, 0x1d, 0x45, 0xe1, 0x9d, 0xc5 };
QemuSpiceKbd *kbd = container_of(sin, QemuSpiceKbd, sin);
int keycode;
bool up;
@@ -57,6 +59,18 @@ static void kbd_push_key(SpiceKbdInstance *sin, uint8_t scancode)
kbd->emul0 = true;
return;
}
+
+ if (scancode == pauseseq[kbd->pauseseq]) {
+ kbd->pauseseq++;
+ if (kbd->pauseseq == G_N_ELEMENTS(pauseseq)) {
+ qemu_input_event_send_key_qcode(NULL, Q_KEY_CODE_PAUSE, true);
+ kbd->pauseseq = 0;
+ }
+ return;
+ } else {
+ kbd->pauseseq = 0;
+ }
+
keycode = scancode & ~SCANCODE_UP;
up = scancode & SCANCODE_UP;
if (kbd->emul0) {
--
2.13.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v3] ps2: fix sending of PAUSE/BREAK scancodes
2017-07-27 14:11 [Qemu-devel] [PATCH v3] ps2: fix sending of PAUSE/BREAK scancodes Daniel P. Berrange
@ 2017-07-27 15:48 ` Gerd Hoffmann
2017-07-27 15:48 ` Daniel P. Berrange
0 siblings, 1 reply; 3+ messages in thread
From: Gerd Hoffmann @ 2017-07-27 15:48 UTC (permalink / raw)
To: Daniel P. Berrange, qemu-devel; +Cc: Hervé Poussineau
Hi,
> Changed in v3:
>
> - Treat entire '0xe1 0x1d 0x45 0xe1 0x9d 0xc5' as make code,
> there is no break code for PAUSE.
Peter just pulled, can you send this as incremetal against v2?
thanks,
Gerd
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v3] ps2: fix sending of PAUSE/BREAK scancodes
2017-07-27 15:48 ` Gerd Hoffmann
@ 2017-07-27 15:48 ` Daniel P. Berrange
0 siblings, 0 replies; 3+ messages in thread
From: Daniel P. Berrange @ 2017-07-27 15:48 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel, Hervé Poussineau
On Thu, Jul 27, 2017 at 05:48:06PM +0200, Gerd Hoffmann wrote:
> Hi,
>
> > Changed in v3:
> >
> > - Treat entire '0xe1 0x1d 0x45 0xe1 0x9d 0xc5' as make code,
> > there is no break code for PAUSE.
>
> Peter just pulled, can you send this as incremetal against v2?
Sure, will do.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-07-27 15:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-27 14:11 [Qemu-devel] [PATCH v3] ps2: fix sending of PAUSE/BREAK scancodes Daniel P. Berrange
2017-07-27 15:48 ` Gerd Hoffmann
2017-07-27 15:48 ` 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).