From: "Daniel P. Berrange" <berrange@redhat.com>
To: "Hervé Poussineau" <hpoussin@reactos.org>
Cc: qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH for 2.10] ps2: fix sending of PAUSE/BREAK scancodes
Date: Tue, 25 Jul 2017 09:32:51 +0100 [thread overview]
Message-ID: <20170725083251.GB26394@redhat.com> (raw)
In-Reply-To: <88f8a661-f832-1d03-2736-d7b35c920e32@reactos.org>
On Mon, Jul 24, 2017 at 09:55:20PM +0200, Hervé Poussineau wrote:
> Le 24/07/2017 à 18:46, Daniel P. Berrange a écrit :
> > 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.
>
> Your commit message is divided in 2 parts, and you're touching 1 file for each part of the commit message.
> Should it be 2 patches instead?
>
> >
> > 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;
> > + }
> > +
>
> You're putting some specific code for spice in ps2 emulation.
> IMO, the workaround should be moved to spice keyboard handling (ui/spice-input.c),
> which needs to generate a qcode instead of a scancode.
This isn't really a spice specific hack. QEMU internal code is *not* required
to use qcodes - the KeyValue struct is a union that allows use of either qcodes
or XT scancodes, and the latter is what all the frontends (SPICE, VNC, GTk, SDL)
use. QCodes are really only input by the monitor (the sendkey command).
> Here, you're making ps2 emulation work again with spice, but you're missing all
> other emulations using qcodes. Do you want to also modify them?
I checked the USB keyboard device and that works fine. AFAIK, the PS/2
code is the only code that takes XT scancodes, converts to qcode and
then converts qcodes back to scancodes - most others avoid this kind of
roundtripping via qcodes.
> I understand that it may be the easiest way to fix the regression for 2.10, but
> it needs at least a comment.
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 :|
next prev parent reply other threads:[~2017-07-25 8:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170725083251.GB26394@redhat.com \
--to=berrange@redhat.com \
--cc=hpoussin@reactos.org \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).