mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 18:23:57 -06:00
usb: restore USBDevice->attached on vmload
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
9a77340827
commit
495d544798
1 changed files with 13 additions and 0 deletions
13
hw/usb/bus.c
13
hw/usb/bus.c
|
@ -37,10 +37,23 @@ static const TypeInfo usb_bus_info = {
|
||||||
static int next_usb_bus = 0;
|
static int next_usb_bus = 0;
|
||||||
static QTAILQ_HEAD(, USBBus) busses = QTAILQ_HEAD_INITIALIZER(busses);
|
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 = {
|
const VMStateDescription vmstate_usb_device = {
|
||||||
.name = "USBDevice",
|
.name = "USBDevice",
|
||||||
.version_id = 1,
|
.version_id = 1,
|
||||||
.minimum_version_id = 1,
|
.minimum_version_id = 1,
|
||||||
|
.post_load = usb_device_post_load,
|
||||||
.fields = (VMStateField []) {
|
.fields = (VMStateField []) {
|
||||||
VMSTATE_UINT8(addr, USBDevice),
|
VMSTATE_UINT8(addr, USBDevice),
|
||||||
VMSTATE_INT32(state, USBDevice),
|
VMSTATE_INT32(state, USBDevice),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue