static void usbredir_control_packet(void *priv, uint32_t id,

    struct usb_redir_control_packet_header *control_packet,

    uint8_t *data, int data_len)

{

    USBRedirDevice *dev = priv;

    int len = control_packet->length;

    AsyncURB *aurb;



    DPRINTF("ctrl-in status %d len %d id %u\n", control_packet->status,

            len, id);



    aurb = async_find(dev, id);

    if (!aurb) {

        free(data);

        return;

    }



    aurb->control_packet.status = control_packet->status;

    aurb->control_packet.length = control_packet->length;

    if (memcmp(&aurb->control_packet, control_packet,

               sizeof(*control_packet))) {

        ERROR("return control packet mismatch, please report this!\n");

        len = USB_RET_NAK;

    }



    if (aurb->packet) {

        len = usbredir_handle_status(dev, control_packet->status, len);

        if (len > 0) {

            usbredir_log_data(dev, "ctrl data in:", data, data_len);

            if (data_len <= sizeof(dev->dev.data_buf)) {

                memcpy(dev->dev.data_buf, data, data_len);

            } else {

                ERROR("ctrl buffer too small (%d > %zu)\n",

                      data_len, sizeof(dev->dev.data_buf));

                len = USB_RET_STALL;

            }

        }

        aurb->packet->len = len;

        usb_generic_async_ctrl_complete(&dev->dev, aurb->packet);

    }

    async_free(dev, aurb);

    free(data);

}

static void usbredir_control_packet(void *priv, uint32_t id,

    struct usb_redir_control_packet_header *control_packet,

    uint8_t *data, int data_len)

{

    USBRedirDevice *dev = priv;

    int len = control_packet->length;

    AsyncURB *aurb;



    DPRINTF("ctrl-in status %d len %d id %u\n", control_packet->status,

            len, id);



    aurb = async_find(dev, id);

    if (!aurb) {

        free(data);

        return;

    }



    aurb->control_packet.status = control_packet->status;

    aurb->control_packet.length = control_packet->length;

    if (memcmp(&aurb->control_packet, control_packet,

               sizeof(*control_packet))) {

        ERROR("return control packet mismatch, please report this!\n");

        len = USB_RET_NAK;

    }



    if (aurb->packet) {

        len = usbredir_handle_status(dev, control_packet->status, len);

        if (len > 0) {

            usbredir_log_data(dev, "ctrl data in:", data, data_len);

            if (data_len <= sizeof(dev->dev.data_buf)) {

                memcpy(dev->dev.data_buf, data, data_len);

            } else {

                ERROR("ctrl buffer too small (%d > %zu)\n",

                      data_len, sizeof(dev->dev.data_buf));

                len = USB_RET_STALL;

            }

        }

        aurb->packet->len = len;

        usb_generic_async_ctrl_complete(&dev->dev, aurb->packet);

    }

    async_free(dev, aurb);

    free(data);

}

        aurb->packet->len = len;         aurb->packet->len = len;
static void FUNC_0(void *VAR_0, uint32_t VAR_1,

    struct usb_redir_control_packet_header *VAR_2,

    uint8_t *VAR_3, int VAR_4)

{

    USBRedirDevice *dev = VAR_0;

    int VAR_5 = VAR_2->length;

    AsyncURB *aurb;



    DPRINTF("ctrl-in status %d VAR_5 %d VAR_1 %u\n", VAR_2->status,

            VAR_5, VAR_1);



    aurb = async_find(dev, VAR_1);

    if (!aurb) {

        free(VAR_3);

        return;

    }



    aurb->VAR_2.status = VAR_2->status;

    aurb->VAR_2.length = VAR_2->length;

    if (memcmp(&aurb->VAR_2, VAR_2,

               sizeof(*VAR_2))) {

        ERROR("return control packet mismatch, please report this!\n");

        VAR_5 = USB_RET_NAK;

    }



    if (aurb->packet) {

        VAR_5 = usbredir_handle_status(dev, VAR_2->status, VAR_5);

        if (VAR_5 > 0) {

            usbredir_log_data(dev, "ctrl VAR_3 in:", VAR_3, VAR_4);

            if (VAR_4 <= sizeof(dev->dev.data_buf)) {

                memcpy(dev->dev.data_buf, VAR_3, VAR_4);

            } else {

                ERROR("ctrl buffer too small (%d > %zu)\n",

                      VAR_4, sizeof(dev->dev.data_buf));

                VAR_5 = USB_RET_STALL;

            }

        }

        aurb->packet->VAR_5 = VAR_5;

        usb_generic_async_ctrl_complete(&dev->dev, aurb->packet);

    }

    async_free(dev, aurb);

    free(VAR_3);

}

static void FUNC_0(void *VAR_0, uint32_t VAR_1,
struct usb_redir_control_packet_header *VAR_2,
uint8_t *VAR_3, int VAR_4)
{ USBRedirDevice *dev = VAR_0; int VAR_5 = VAR_2->length; AsyncURB *aurb; DPRINTF("ctrl-in status %d VAR_5 %d VAR_1 %u\n", VAR_2->status,
VAR_5, VAR_1); aurb = async_find(dev, VAR_1); if (!aurb) { free(VAR_3); return; } aurb->VAR_2.status = VAR_2->status; aurb->VAR_2.length = VAR_2->length; if (memcmp(&aurb->VAR_2, VAR_2,
sizeof(*VAR_2))) { ERROR("return control packet mismatch, please report this!\n"); VAR_5 = USB_RET_NAK; } if (aurb->packet) { VAR_5 = usbredir_handle_status(dev, VAR_2->status, VAR_5); if (VAR_5 > 0) { usbredir_log_data(dev, "ctrl VAR_3 in:", VAR_3, VAR_4); if (VAR_4 <= sizeof(dev->dev.data_buf)) { memcpy(dev->dev.data_buf, VAR_3, VAR_4); } else { ERROR("ctrl buffer too small (%d > %zu)\n",
VAR_4, sizeof(dev->dev.data_buf)); VAR_5 = USB_RET_STALL; } } aurb->packet->VAR_5 = VAR_5; usb_generic_async_ctrl_complete(&dev->dev, aurb->packet); } async_free(dev, aurb); free(VAR_3); }