diff options
author | Michael Walle <michael@walle.cc> | 2011-08-09 23:54:54 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2011-08-10 14:14:00 +0200 |
commit | 1f42d22233b4f3d1a2933ff30e8d6a6d9ee2d08f (patch) | |
tree | 68c3c3d71244f12d881f6a0cfa89763cfd189a29 /hw/usb-hid.c | |
parent | ccd4ed065be4023c86252d25118cc96abf77df66 (diff) | |
download | qemu-1f42d22233b4f3d1a2933ff30e8d6a6d9ee2d08f.zip qemu-1f42d22233b4f3d1a2933ff30e8d6a6d9ee2d08f.tar.gz qemu-1f42d22233b4f3d1a2933ff30e8d6a6d9ee2d08f.tar.bz2 |
usb-hid: use hid vmstate macro
Use new hid vmstate macro. Version stays the same, because there is no
reordering of the fields.
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb-hid.c')
-rw-r--r-- | hw/usb-hid.c | 41 |
1 files changed, 2 insertions, 39 deletions
diff --git a/hw/usb-hid.c b/hw/usb-hid.c index 6f12751..6a75147 100644 --- a/hw/usb-hid.c +++ b/hw/usb-hid.c @@ -541,41 +541,13 @@ 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, .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() } }; @@ -584,18 +556,9 @@ static const VMStateDescription vmstate_usb_kbd = { .name = "usb-kbd", .version_id = 1, .minimum_version_id = 1, - .post_load = usb_hid_post_load, .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() } }; |