/* The usb-host may poll the endpoint faster then our guest, resulting in lots of smaller bulkp-s. The below buffered_bulk_in_complete* functions combine data from multiple bulkp-s into a single packet, avoiding bufpq overflows.  */
static void usbredir_buffered_bulk_add_data_to_packet(USBRedirDevice *dev, struct buf_packet *bulkp, int count, USBPacket *p, uint8_t ep)
/* The usb-host may poll the endpoint faster then our guest, resulting in lots of smaller bulkp-s. The below buffered_bulk_in_complete* functions combine data from multiple bulkp-s into a single packet, avoiding bufpq overflows.  */
static void usbredir_buffered_bulk_add_data_to_packet(USBRedirDevice *dev, struct buf_packet *bulkp, int count, USBPacket *p, uint8_t ep)
{
    usb_packet_copy(p, bulkp->data + bulkp->offset, count);
    bulkp->offset += count;
    if (bulkp->offset == bulkp->len) {
        usbredir_handle_status(dev, p, bulkp->status);
        bufp_free(dev, bulkp, ep);
    }
}