On 02/07/2011 10:34 AM, Alon Levy wrote:
+static int ccid_post_load(void *opaque, int version_id) +{ + USBCCIDState *s = opaque; + + // This must be done after usb_device_attach, which sets state to ATTACHED, + // while it must be DEFAULT in order to accept packets (like it is after + // reset, but reset will reset our addr and call our reset handler which + // may change state, and we don't want to do that when migrating). + s->dev.state = s->state_vmstate; + return 0; +} + +static void ccid_pre_save(void *opaque) +{ + USBCCIDState *s = opaque; + + s->state_vmstate = s->dev.state; + if (s->dev.attached) { + // migrating an open device, ignore reconnection CHR_EVENT to avoid an + // erronous detach. + s->migration_state = MIGRATION_MIGRATED; + }
Still using C99 comments, should be C89. Regards, Anthony Liguori