From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 2/5] usb: restore USBDevice->attached on vmload
Date: Tue, 12 Jun 2012 09:54:15 +0200 [thread overview]
Message-ID: <1339487658-8969-3-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1339487658-8969-1-git-send-email-kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/bus.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index 2068640..77b2b99 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -27,10 +27,23 @@ static struct BusInfo usb_bus_info = {
static int next_usb_bus = 0;
static QTAILQ_HEAD(, USBBus) busses = QTAILQ_HEAD_INITIALIZER(busses);
+static int usb_device_post_load(void *opaque, int version_id)
+{
+ USBDevice *dev = opaque;
+
+ if (dev->state == USB_STATE_NOTATTACHED) {
+ dev->attached = 0;
+ } else {
+ dev->attached = 1;
+ }
+ return 0;
+}
+
const VMStateDescription vmstate_usb_device = {
.name = "USBDevice",
.version_id = 1,
.minimum_version_id = 1,
+ .post_load = usb_device_post_load,
.fields = (VMStateField []) {
VMSTATE_UINT8(addr, USBDevice),
VMSTATE_INT32(state, USBDevice),
--
1.7.1
next prev parent reply other threads:[~2012-06-12 7:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-12 7:54 [Qemu-devel] [PATCH 0/5] usb: live migration bits Gerd Hoffmann
2012-06-12 7:54 ` [Qemu-devel] [PATCH 1/5] ehci: add live migration support Gerd Hoffmann
2012-06-12 7:54 ` Gerd Hoffmann [this message]
2012-06-12 7:54 ` [Qemu-devel] [PATCH 3/5] ehci: tracing improvements Gerd Hoffmann
2012-06-12 7:54 ` [Qemu-devel] [PATCH 4/5] usb-host: attach only to running guest Gerd Hoffmann
2012-06-12 7:54 ` [Qemu-devel] [PATCH 5/5] usb-host: live migration support 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=1339487658-8969-3-git-send-email-kraxel@redhat.com \
--to=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).