From: Anthony Liguori <anthony@codemonkey.ws>
To: Christophe Fergeau <cfergeau@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] ps2: migrate ledstate
Date: Wed, 12 Oct 2011 11:42:38 -0500 [thread overview]
Message-ID: <4E95C37E.20502@codemonkey.ws> (raw)
In-Reply-To: <1318437328-16865-1-git-send-email-cfergeau@redhat.com>
On 10/12/2011 11:35 AM, Christophe Fergeau wrote:
> Make the ps2 device track its ledstate so that we can migrate it.
> Otherwise it gets lost across migration, and spice-server gets
> confused about the actual keyboard state and sends bogus
> caps/scroll/num key events.
>
> Signed-off-by: Christophe Fergeau<cfergeau@redhat.com>
> ---
> hw/ps2.c | 13 +++++++++++--
> 1 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/hw/ps2.c b/hw/ps2.c
> index 24228c1..f19ea18 100644
> --- a/hw/ps2.c
> +++ b/hw/ps2.c
> @@ -92,6 +92,7 @@ typedef struct {
> not the keyboard controller. */
> int translate;
> int scancode_set; /* 1=XT, 2=AT, 3=PS/2 */
> + int ledstate;
> } PS2KbdState;
>
> typedef struct {
> @@ -195,11 +196,17 @@ uint32_t ps2_read_data(void *opaque)
> return val;
> }
>
> +static void ps2_set_ledstate(PS2KbdState *s, int ledstate)
> +{
> + s->ledstate = ledstate;
> + kbd_put_ledstate(ledstate);
> +}
> +
> static void ps2_reset_keyboard(PS2KbdState *s)
> {
> s->scan_enabled = 1;
> s->scancode_set = 2;
> - kbd_put_ledstate(0);
> + ps2_set_ledstate(s, 0);
> }
>
> void ps2_write_keyboard(void *opaque, int val)
> @@ -274,7 +281,7 @@ void ps2_write_keyboard(void *opaque, int val)
> s->common.write_cmd = -1;
> break;
> case KBD_CMD_SET_LEDS:
> - kbd_put_ledstate(val);
> + ps2_set_ledstate(s, val);
> ps2_queue(&s->common, KBD_REPLY_ACK);
> s->common.write_cmd = -1;
> break;
> @@ -563,6 +570,7 @@ static int ps2_kbd_post_load(void* opaque, int version_id)
>
> if (version_id == 2)
> s->scancode_set=2;
> + kbd_put_ledstate(s->ledstate);
> return 0;
> }
>
> @@ -577,6 +585,7 @@ static const VMStateDescription vmstate_ps2_keyboard = {
> VMSTATE_INT32(scan_enabled, PS2KbdState),
> VMSTATE_INT32(translate, PS2KbdState),
> VMSTATE_INT32_V(scancode_set, PS2KbdState,3),
> + VMSTATE_INT32(ledstate, PS2KbdState),
If you're adding a field, you need to bump the version.
Regards,
Anthony Liguori
> VMSTATE_END_OF_LIST()
> }
> };
next prev parent reply other threads:[~2011-10-12 16:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-11 16:28 [Qemu-devel] [PATCH] spice-input: migrate ledstate Alon Levy
2011-10-11 18:23 ` Anthony Liguori
2011-10-11 18:30 ` Alon Levy
2011-10-12 7:45 ` Gerd Hoffmann
2011-10-12 16:35 ` [Qemu-devel] [PATCH] ps2: " Christophe Fergeau
2011-10-12 16:42 ` Anthony Liguori [this message]
2011-10-12 17:17 ` [Qemu-devel] [PATCHv2] " Christophe Fergeau
2011-10-14 15:44 ` [Qemu-devel] [PATCHv3] " Christophe Fergeau
2011-10-17 9:25 ` Gerd Hoffmann
2011-10-17 10:10 ` Christophe Fergeau
2011-10-12 16:47 ` [Qemu-devel] [PATCH] " Christophe Fergeau
2011-10-13 7:49 ` Gerd Hoffmann
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=4E95C37E.20502@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=cfergeau@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.