提交 1f1f0600 编写于 作者: J Juan Quintela 提交者: Anthony Liguori

vmstate: port adb_kbd

Signed-off-by: NJuan Quintela <quintela@redhat.com>
上级 ec444452
...@@ -261,30 +261,19 @@ static int adb_kbd_request(ADBDevice *d, uint8_t *obuf, ...@@ -261,30 +261,19 @@ static int adb_kbd_request(ADBDevice *d, uint8_t *obuf,
return olen; return olen;
} }
static void adb_kbd_save(QEMUFile *f, void *opaque) static const VMStateDescription vmstate_adb_kbd = {
{ .name = "adb_kbd",
KBDState *s = (KBDState *)opaque; .version_id = 1,
.minimum_version_id = 1,
qemu_put_buffer(f, s->data, sizeof(s->data)); .minimum_version_id_old = 1,
qemu_put_sbe32s(f, &s->rptr); .fields = (VMStateField[]) {
qemu_put_sbe32s(f, &s->wptr); VMSTATE_BUFFER(data, KBDState),
qemu_put_sbe32s(f, &s->count); VMSTATE_INT32(rptr, KBDState),
} VMSTATE_INT32(wptr, KBDState),
VMSTATE_INT32(count, KBDState),
static int adb_kbd_load(QEMUFile *f, void *opaque, int version_id) VMSTATE_END_OF_LIST()
{ }
KBDState *s = (KBDState *)opaque; };
if (version_id != 1)
return -EINVAL;
qemu_get_buffer(f, s->data, sizeof(s->data));
qemu_get_sbe32s(f, &s->rptr);
qemu_get_sbe32s(f, &s->wptr);
qemu_get_sbe32s(f, &s->count);
return 0;
}
static int adb_kbd_reset(ADBDevice *d) static int adb_kbd_reset(ADBDevice *d)
{ {
...@@ -305,8 +294,7 @@ void adb_kbd_init(ADBBusState *bus) ...@@ -305,8 +294,7 @@ void adb_kbd_init(ADBBusState *bus)
d = adb_register_device(bus, ADB_KEYBOARD, adb_kbd_request, d = adb_register_device(bus, ADB_KEYBOARD, adb_kbd_request,
adb_kbd_reset, s); adb_kbd_reset, s);
qemu_add_kbd_event_handler(adb_kbd_put_keycode, d); qemu_add_kbd_event_handler(adb_kbd_put_keycode, d);
register_savevm(NULL, "adb_kbd", -1, 1, adb_kbd_save, vmstate_register(NULL, -1, &vmstate_adb_kbd, s);
adb_kbd_load, s);
} }
/***************************************************************/ /***************************************************************/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册