From: Michael Walle <michael@walle.cc>
To: qemu-devel@nongnu.org
Cc: Michael Walle <michael@walle.cc>, Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 3/4] usb-hid: use hid vmstate macro
Date: Sun, 7 Aug 2011 19:29:19 +0200 [thread overview]
Message-ID: <1312738160-28961-4-git-send-email-michael@walle.cc> (raw)
In-Reply-To: <1312738160-28961-1-git-send-email-michael@walle.cc>
Increase version id, this will make almost any saved vm incompatible :(
Signed-off-by: Michael Walle <michael@walle.cc>
---
hw/usb-hid.c | 51 ++++++++-------------------------------------------
1 files changed, 8 insertions(+), 43 deletions(-)
diff --git a/hw/usb-hid.c b/hw/usb-hid.c
index e5d57de..2efbc8d 100644
--- a/hw/usb-hid.c
+++ b/hw/usb-hid.c
@@ -538,61 +538,26 @@ void usb_hid_datain_cb(USBDevice *dev, void *opaque, void (*datain)(void *))
s->datain = datain;
}
-static int usb_hid_post_load(void *opaque, int version_id)
-{
- USBHIDState *s = opaque;
-
- if (s->hid.idle) {
- hid_set_next_idle(&s->hid, qemu_get_clock_ns(vm_clock));
- }
- return 0;
-}
-
-static const VMStateDescription vmstate_usb_ptr_queue = {
- .name = "usb-ptr-queue",
- .version_id = 1,
- .minimum_version_id = 1,
- .fields = (VMStateField []) {
- VMSTATE_INT32(xdx, HIDPointerEvent),
- VMSTATE_INT32(ydy, HIDPointerEvent),
- VMSTATE_INT32(dz, HIDPointerEvent),
- VMSTATE_INT32(buttons_state, HIDPointerEvent),
- VMSTATE_END_OF_LIST()
- }
-};
static const VMStateDescription vmstate_usb_ptr = {
.name = "usb-ptr",
- .version_id = 1,
- .minimum_version_id = 1,
- .post_load = usb_hid_post_load,
+ .version_id = 2,
+ .minimum_version_id = 2,
+ .minimum_version_id_old = 2,
.fields = (VMStateField []) {
VMSTATE_USB_DEVICE(dev, USBHIDState),
- VMSTATE_STRUCT_ARRAY(hid.ptr.queue, USBHIDState, QUEUE_LENGTH, 0,
- vmstate_usb_ptr_queue, HIDPointerEvent),
- VMSTATE_UINT32(hid.head, USBHIDState),
- VMSTATE_UINT32(hid.n, USBHIDState),
- VMSTATE_INT32(hid.protocol, USBHIDState),
- VMSTATE_UINT8(hid.idle, USBHIDState),
+ VMSTATE_HID_POINTER_DEVICE(hid, USBHIDState),
VMSTATE_END_OF_LIST()
}
};
static const VMStateDescription vmstate_usb_kbd = {
.name = "usb-kbd",
- .version_id = 1,
- .minimum_version_id = 1,
- .post_load = usb_hid_post_load,
+ .version_id = 2,
+ .minimum_version_id = 2,
+ .minimum_version_id_old = 2,
.fields = (VMStateField []) {
VMSTATE_USB_DEVICE(dev, USBHIDState),
- VMSTATE_UINT32_ARRAY(hid.kbd.keycodes, USBHIDState, QUEUE_LENGTH),
- VMSTATE_UINT32(hid.head, USBHIDState),
- VMSTATE_UINT32(hid.n, USBHIDState),
- VMSTATE_UINT16(hid.kbd.modifiers, USBHIDState),
- VMSTATE_UINT8(hid.kbd.leds, USBHIDState),
- VMSTATE_UINT8_ARRAY(hid.kbd.key, USBHIDState, 16),
- VMSTATE_INT32(hid.kbd.keys, USBHIDState),
- VMSTATE_INT32(hid.protocol, USBHIDState),
- VMSTATE_UINT8(hid.idle, USBHIDState),
+ VMSTATE_HID_KEYBOARD_DEVICE(hid, USBHIDState),
VMSTATE_END_OF_LIST()
}
};
--
1.7.2.5
next prev parent reply other threads:[~2011-08-07 17:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-07 17:29 [Qemu-devel] [PATCH 0/4] usb/hid: bugfixes, more on usb and hid split Michael Walle
2011-08-07 17:29 ` [Qemu-devel] [PATCH 1/4] hid: register kbd hander in init() Michael Walle
2011-08-07 17:29 ` [Qemu-devel] [PATCH 2/4] hid: introduce hid vmstate macros Michael Walle
2011-08-07 17:29 ` Michael Walle [this message]
2011-08-07 17:29 ` [Qemu-devel] [PATCH 4/4] milkymist-softusb: use hid code directly Michael Walle
2011-08-09 10:35 ` [Qemu-devel] [PATCH 0/4] usb/hid: bugfixes, more on usb and hid split Gerd Hoffmann
-- strict thread matches above, loose matches on Subject: below --
2011-08-09 21:54 [Qemu-devel] [PATCH v2 " Michael Walle
2011-08-09 21:54 ` [Qemu-devel] [PATCH 3/4] usb-hid: use hid vmstate macro Michael Walle
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=1312738160-28961-4-git-send-email-michael@walle.cc \
--to=michael@walle.cc \
--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).