static int usbredir_handle_bulk_data(USBRedirDevice *dev, USBPacket *p,

                                      uint8_t ep)

{

    AsyncURB *aurb = async_alloc(dev, p);

    struct usb_redir_bulk_packet_header bulk_packet;



    DPRINTF("bulk-out ep %02X len %zd id %u\n", ep,

            p->iov.size, aurb->packet_id);



    bulk_packet.endpoint  = ep;

    bulk_packet.length    = p->iov.size;

    bulk_packet.stream_id = 0;

    aurb->bulk_packet = bulk_packet;



    if (ep & USB_DIR_IN) {

        usbredirparser_send_bulk_packet(dev->parser, aurb->packet_id,

                                        &bulk_packet, NULL, 0);

    } else {

        uint8_t buf[p->iov.size];

        usb_packet_copy(p, buf, p->iov.size);

        usbredir_log_data(dev, "bulk data out:", buf, p->iov.size);

        usbredirparser_send_bulk_packet(dev->parser, aurb->packet_id,

                                        &bulk_packet, buf, p->iov.size);

    }

    usbredirparser_do_write(dev->parser);

    return USB_RET_ASYNC;

}

static int usbredir_handle_bulk_data(USBRedirDevice *dev, USBPacket *p,

                                      uint8_t ep)

{

    AsyncURB *aurb = async_alloc(dev, p);

    struct usb_redir_bulk_packet_header bulk_packet;



    DPRINTF("bulk-out ep %02X len %zd id %u\n", ep,

            p->iov.size, aurb->packet_id);



    bulk_packet.endpoint  = ep;

    bulk_packet.length    = p->iov.size;

    bulk_packet.stream_id = 0;

    aurb->bulk_packet = bulk_packet;



    if (ep & USB_DIR_IN) {

        usbredirparser_send_bulk_packet(dev->parser, aurb->packet_id,

                                        &bulk_packet, NULL, 0);

    } else {

        uint8_t buf[p->iov.size];

        usb_packet_copy(p, buf, p->iov.size);

        usbredir_log_data(dev, "bulk data out:", buf, p->iov.size);

        usbredirparser_send_bulk_packet(dev->parser, aurb->packet_id,

                                        &bulk_packet, buf, p->iov.size);

    }

    usbredirparser_do_write(dev->parser);

    return USB_RET_ASYNC;

}

static int FUNC_0(USBRedirDevice *VAR_0, USBPacket *VAR_1,

                                      uint8_t VAR_2)

{

    AsyncURB *aurb = async_alloc(VAR_0, VAR_1);

    struct usb_redir_bulk_packet_header VAR_3;



    DPRINTF("bulk-out VAR_2 %02X len %zd id %u\n", VAR_2,

            VAR_1->iov.size, aurb->packet_id);



    VAR_3.endpoint  = VAR_2;

    VAR_3.length    = VAR_1->iov.size;

    VAR_3.stream_id = 0;

    aurb->VAR_3 = VAR_3;



    if (VAR_2 & USB_DIR_IN) {

        usbredirparser_send_bulk_packet(VAR_0->parser, aurb->packet_id,

                                        &VAR_3, NULL, 0);

    } else {

        uint8_t buf[VAR_1->iov.size];

        usb_packet_copy(VAR_1, buf, VAR_1->iov.size);

        usbredir_log_data(VAR_0, "bulk data out:", buf, VAR_1->iov.size);

        usbredirparser_send_bulk_packet(VAR_0->parser, aurb->packet_id,

                                        &VAR_3, buf, VAR_1->iov.size);

    }

    usbredirparser_do_write(VAR_0->parser);

    return USB_RET_ASYNC;

}

static int FUNC_0(USBRedirDevice *VAR_0, USBPacket *VAR_1,
uint8_t VAR_2)
{ AsyncURB *aurb = async_alloc(VAR_0, VAR_1); struct usb_redir_bulk_packet_header VAR_3; DPRINTF("bulk-out VAR_2 %02X len %zd id %u\n", VAR_2,
VAR_1->iov.size, aurb->packet_id); VAR_3.endpoint  = VAR_2; VAR_3.length    = VAR_1->iov.size; VAR_3.stream_id = 0; aurb->VAR_3 = VAR_3; if (VAR_2 & USB_DIR_IN) { usbredirparser_send_bulk_packet(VAR_0->parser, aurb->packet_id,
&VAR_3, NULL, 0); } else { uint8_t buf[VAR_1->iov.size]; usb_packet_copy(VAR_1, buf, VAR_1->iov.size); usbredir_log_data(VAR_0, "bulk data out:", buf, VAR_1->iov.size); usbredirparser_send_bulk_packet(VAR_0->parser, aurb->packet_id,
&VAR_3, buf, VAR_1->iov.size); } usbredirparser_do_write(VAR_0->parser); return USB_RET_ASYNC; }