From: Alon Levy <alevy@redhat.com>
To: qemu-devel@nongnu.org
Cc: kraxel@redhat.com, cfergeau@redhat.com
Subject: [Qemu-devel] [PATCH v2] spice-input: migrate ledstate
Date: Tue, 11 Oct 2011 18:56:10 +0200 [thread overview]
Message-ID: <1318352170-27402-1-git-send-email-alevy@redhat.com> (raw)
The caps/scroll/num lock state is not tracked by the ps2 device, but by
spice-input QemuSpiceKbd->ledstate. To fix losing it across migration,
and then having the server send caps/scroll/nums keys when the client
sends a SPICE_MSGC_INPUTS_KEY_MODIFIERS, migrate it.
RHBZ# 729294
Signed-off-by: Alon Levy <alevy@redhat.com>
---
v2: fix vmstate name from spice-input to spice-input-kbd
---
trace-events | 3 +++
ui/spice-input.c | 24 ++++++++++++++++++++++++
2 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/trace-events b/trace-events
index 63d8c8e..605dc79 100644
--- a/trace-events
+++ b/trace-events
@@ -538,3 +538,6 @@ esp_mem_writeb_cmd_ensel(uint32_t val) "Enable selection (%2.2x)"
# monitor.c
handle_qmp_command(void *mon, const char *cmd_name) "mon %p cmd_name \"%s\""
monitor_protocol_emitter(void *mon) "mon %p"
+
+# ui/spice-input.c
+disable spice_input_post_load(int ledstate) "leds %d"
diff --git a/ui/spice-input.c b/ui/spice-input.c
index af4223d..d873019 100644
--- a/ui/spice-input.c
+++ b/ui/spice-input.c
@@ -26,6 +26,8 @@
#include "qemu-common.h"
#include "qemu-spice.h"
#include "console.h"
+#include "hw/hw.h"
+#include "trace.h"
/* keyboard bits */
@@ -195,6 +197,27 @@ static void mouse_mode_notifier(Notifier *notifier, void *data)
pointer->absolute = is_absolute;
}
+static int qemu_spice_input_post_load(void *opaque, int version_id)
+{
+ QemuSpiceKbd *s = (QemuSpiceKbd *)opaque;
+
+ trace_spice_input_post_load(s->ledstate);
+ kbd_leds(s, s->ledstate);
+ return 0;
+}
+
+static const VMStateDescription vmstate_spice_kbd = {
+ .name = "spice-input-kbd",
+ .version_id = 0,
+ .minimum_version_id = 0,
+ .minimum_version_id_old = 0,
+ .post_load = qemu_spice_input_post_load,
+ .fields = (VMStateField[]) {
+ VMSTATE_INT32(ledstate, QemuSpiceKbd),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
void qemu_spice_input_init(void)
{
QemuSpiceKbd *kbd;
@@ -204,6 +227,7 @@ void qemu_spice_input_init(void)
kbd->sin.base.sif = &kbd_interface.base;
qemu_spice_add_interface(&kbd->sin.base);
qemu_add_led_event_handler(kbd_leds, kbd);
+ vmstate_register(NULL, 0, &vmstate_spice_kbd, kbd);
pointer = g_malloc0(sizeof(*pointer));
pointer->mouse.base.sif = &mouse_interface.base;
--
1.7.6.4
reply other threads:[~2011-10-11 18:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1318352170-27402-1-git-send-email-alevy@redhat.com \
--to=alevy@redhat.com \
--cc=cfergeau@redhat.com \
--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).