static void usbredir_interrupt_packet(void *priv, uint32_t id,

    struct usb_redir_interrupt_packet_header *interrupt_packet,

    uint8_t *data, int data_len)

{

    USBRedirDevice *dev = priv;

    uint8_t ep = interrupt_packet->endpoint;



    DPRINTF("interrupt-in status %d ep %02X len %d id %u\n",

            interrupt_packet->status, ep, data_len, id);



    if (dev->endpoint[EP2I(ep)].type != USB_ENDPOINT_XFER_INT) {

        ERROR("received int packet for non interrupt endpoint %02X\n", ep);

        free(data);

        return;

    }



    if (ep & USB_DIR_IN) {

        if (dev->endpoint[EP2I(ep)].interrupt_started == 0) {

            DPRINTF("received int packet while not started ep %02X\n", ep);

            free(data);

            return;

        }



        /* bufp_alloc also adds the packet to the ep queue */

        bufp_alloc(dev, data, data_len, interrupt_packet->status, ep);

    } else {

        int len = interrupt_packet->length;



        AsyncURB *aurb = async_find(dev, id);

        if (!aurb) {

            return;

        }



        if (aurb->interrupt_packet.endpoint != interrupt_packet->endpoint) {

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

            len = USB_RET_NAK;

        }



        if (aurb->packet) {

            aurb->packet->len = usbredir_handle_status(dev,

                                               interrupt_packet->status, len);

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

        }

        async_free(dev, aurb);

    }

}

static void usbredir_interrupt_packet(void *priv, uint32_t id,

    struct usb_redir_interrupt_packet_header *interrupt_packet,

    uint8_t *data, int data_len)

{

    USBRedirDevice *dev = priv;

    uint8_t ep = interrupt_packet->endpoint;



    DPRINTF("interrupt-in status %d ep %02X len %d id %u\n",

            interrupt_packet->status, ep, data_len, id);



    if (dev->endpoint[EP2I(ep)].type != USB_ENDPOINT_XFER_INT) {

        ERROR("received int packet for non interrupt endpoint %02X\n", ep);

        free(data);

        return;

    }



    if (ep & USB_DIR_IN) {

        if (dev->endpoint[EP2I(ep)].interrupt_started == 0) {

            DPRINTF("received int packet while not started ep %02X\n", ep);

            free(data);

            return;

        }



        

        bufp_alloc(dev, data, data_len, interrupt_packet->status, ep);

    } else {

        int len = interrupt_packet->length;



        AsyncURB *aurb = async_find(dev, id);

        if (!aurb) {

            return;

        }



        if (aurb->interrupt_packet.endpoint != interrupt_packet->endpoint) {

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

            len = USB_RET_NAK;

        }



        if (aurb->packet) {

            aurb->packet->len = usbredir_handle_status(dev,

                                               interrupt_packet->status, len);

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

        }

        async_free(dev, aurb);

    }

}

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

    struct usb_redir_interrupt_packet_header *VAR_2,

    uint8_t *VAR_3, int VAR_4)

{

    USBRedirDevice *dev = VAR_0;

    uint8_t ep = VAR_2->endpoint;



    DPRINTF("interrupt-in status %d ep %02X VAR_5 %d VAR_1 %u\n",

            VAR_2->status, ep, VAR_4, VAR_1);



    if (dev->endpoint[EP2I(ep)].type != USB_ENDPOINT_XFER_INT) {

        ERROR("received int packet for non interrupt endpoint %02X\n", ep);

        free(VAR_3);

        return;

    }



    if (ep & USB_DIR_IN) {

        if (dev->endpoint[EP2I(ep)].interrupt_started == 0) {

            DPRINTF("received int packet while not started ep %02X\n", ep);

            free(VAR_3);

            return;

        }



        

        bufp_alloc(dev, VAR_3, VAR_4, VAR_2->status, ep);

    } else {

        int VAR_5 = VAR_2->length;



        AsyncURB *aurb = async_find(dev, VAR_1);

        if (!aurb) {

            return;

        }



        if (aurb->VAR_2.endpoint != VAR_2->endpoint) {

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

            VAR_5 = USB_RET_NAK;

        }



        if (aurb->packet) {

            aurb->packet->VAR_5 = usbredir_handle_status(dev,

                                               VAR_2->status, VAR_5);

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

        }

        async_free(dev, aurb);

    }

}

static void FUNC_0(void *VAR_0, uint32_t VAR_1,
struct usb_redir_interrupt_packet_header *VAR_2,
uint8_t *VAR_3, int VAR_4)
{ USBRedirDevice *dev = VAR_0; uint8_t ep = VAR_2->endpoint; DPRINTF("interrupt-in status %d ep %02X VAR_5 %d VAR_1 %u\n",
VAR_2->status, ep, VAR_4, VAR_1); if (dev->endpoint[EP2I(ep)].type != USB_ENDPOINT_XFER_INT) { ERROR("received int packet for non interrupt endpoint %02X\n", ep); free(VAR_3); return; } if (ep & USB_DIR_IN) { if (dev->endpoint[EP2I(ep)].interrupt_started == 0) { DPRINTF("received int packet while not started ep %02X\n", ep); free(VAR_3); return; } bufp_alloc(dev, VAR_3, VAR_4, VAR_2->status, ep); } else { int VAR_5 = VAR_2->length; AsyncURB *aurb = async_find(dev, VAR_1); if (!aurb) { return; } if (aurb->VAR_2.endpoint != VAR_2->endpoint) { ERROR("return int packet mismatch, please report this!\n"); VAR_5 = USB_RET_NAK; } if (aurb->packet) { aurb->packet->VAR_5 = usbredir_handle_status(dev,
VAR_2->status, VAR_5); usb_packet_complete(&dev->dev, aurb->packet); } async_free(dev, aurb); } }