static void usbredir_device_disconnect(void *priv)

{

    USBRedirDevice *dev = priv;

    int i;



    /* Stop any pending attaches */

    qemu_del_timer(dev->attach_timer);



    if (dev->dev.attached) {

        usb_device_detach(&dev->dev);

        /*

         * Delay next usb device attach to give the guest a chance to see

         * see the detach / attach in case of quick close / open succession

         */

        dev->next_attach_time = qemu_get_clock_ms(vm_clock) + 200;

    }



    /* Reset state so that the next dev connected starts with a clean slate */

    usbredir_cleanup_device_queues(dev);

    memset(dev->endpoint, 0, sizeof(dev->endpoint));

    for (i = 0; i < MAX_ENDPOINTS; i++) {

        QTAILQ_INIT(&dev->endpoint[i].bufpq);

    }

    usb_ep_init(&dev->dev);

    dev->interface_info.interface_count = 0;

}

static void usbredir_device_disconnect(void *priv)

{

    USBRedirDevice *dev = priv;

    int i;



    

    qemu_del_timer(dev->attach_timer);



    if (dev->dev.attached) {

        usb_device_detach(&dev->dev);

        







        dev->next_attach_time = qemu_get_clock_ms(vm_clock) + 200;

    }



    

    usbredir_cleanup_device_queues(dev);

    memset(dev->endpoint, 0, sizeof(dev->endpoint));

    for (i = 0; i < MAX_ENDPOINTS; i++) {

        QTAILQ_INIT(&dev->endpoint[i].bufpq);

    }

    usb_ep_init(&dev->dev);

    dev->interface_info.interface_count = 0;

}

static void FUNC_0(void *VAR_0)

{

    USBRedirDevice *dev = VAR_0;

    int VAR_1;



    

    qemu_del_timer(dev->attach_timer);



    if (dev->dev.attached) {

        usb_device_detach(&dev->dev);

        







        dev->next_attach_time = qemu_get_clock_ms(vm_clock) + 200;

    }



    

    usbredir_cleanup_device_queues(dev);

    memset(dev->endpoint, 0, sizeof(dev->endpoint));

    for (VAR_1 = 0; VAR_1 < MAX_ENDPOINTS; VAR_1++) {

        QTAILQ_INIT(&dev->endpoint[VAR_1].bufpq);

    }

    usb_ep_init(&dev->dev);

    dev->interface_info.interface_count = 0;

}

static void FUNC_0(void *VAR_0)
{ USBRedirDevice *dev = VAR_0; int VAR_1; qemu_del_timer(dev->attach_timer); if (dev->dev.attached) { usb_device_detach(&dev->dev); dev->next_attach_time = qemu_get_clock_ms(vm_clock) + 200; } usbredir_cleanup_device_queues(dev); memset(dev->endpoint, 0, sizeof(dev->endpoint)); for (VAR_1 = 0; VAR_1 < MAX_ENDPOINTS; VAR_1++) { QTAILQ_INIT(&dev->endpoint[VAR_1].bufpq); } usb_ep_init(&dev->dev); dev->interface_info.interface_count = 0; }