static void usbredir_check_bulk_receiving(USBRedirDevice *dev)
{
    int i, j, quirks;

    if (!usbredirparser_peer_has_cap(dev->parser,
                                     usb_redir_cap_bulk_receiving)) {
        return;
    }

    for (i = EP2I(USB_DIR_IN); i < MAX_ENDPOINTS; i++) {
        dev->endpoint[i].bulk_receiving_enabled = 0;
    }

    if (dev->interface_info.interface_count == NO_INTERFACE_INFO) {
        return;
    }

    for (i = 0; i < dev->interface_info.interface_count; i++) {
        quirks = usb_get_quirks(dev->device_info.vendor_id,
                                dev->device_info.product_id,
                                dev->interface_info.interface_class[i],
                                dev->interface_info.interface_subclass[i],
                                dev->interface_info.interface_protocol[i]);
        if (!(quirks & USB_QUIRK_BUFFER_BULK_IN)) {
            continue;
        }
        if (quirks & USB_QUIRK_IS_FTDI) {
            dev->buffered_bulk_in_complete =
                usbredir_buffered_bulk_in_complete_ftdi;
        } else {
            dev->buffered_bulk_in_complete =
                usbredir_buffered_bulk_in_complete_raw;
        }

        for (j = EP2I(USB_DIR_IN); j < MAX_ENDPOINTS; j++) {
            if (dev->endpoint[j].interface ==
                                    dev->interface_info.interface[i] &&
                    dev->endpoint[j].type == USB_ENDPOINT_XFER_BULK &&
                    dev->endpoint[j].max_packet_size != 0) {
                dev->endpoint[j].bulk_receiving_enabled = 1;
                /*
                 * With buffering pipelining is not necessary. Also packet
                 * combining and bulk in buffering don't play nice together!
                 */
                I2USBEP(dev, j)->pipeline = false;
                break; /* Only buffer for the first ep of each intf */
            }
        }
    }
}
static void usbredir_check_bulk_receiving(USBRedirDevice *dev)
{
    int i, j, quirks;

    if (!usbredirparser_peer_has_cap(dev->parser,
                                     usb_redir_cap_bulk_receiving)) {
        return;
    }

    for (i = EP2I(USB_DIR_IN); i < MAX_ENDPOINTS; i++) {
        dev->endpoint[i].bulk_receiving_enabled = 0;
    }

    if (dev->interface_info.interface_count == NO_INTERFACE_INFO) {
        return;
    }

    for (i = 0; i < dev->interface_info.interface_count; i++) {
        quirks = usb_get_quirks(dev->device_info.vendor_id,
                                dev->device_info.product_id,
                                dev->interface_info.interface_class[i],
                                dev->interface_info.interface_subclass[i],
                                dev->interface_info.interface_protocol[i]);
        if (!(quirks & USB_QUIRK_BUFFER_BULK_IN)) {
            continue;
        }
        if (quirks & USB_QUIRK_IS_FTDI) {
            dev->buffered_bulk_in_complete =
                usbredir_buffered_bulk_in_complete_ftdi;
        } else {
            dev->buffered_bulk_in_complete =
                usbredir_buffered_bulk_in_complete_raw;
        }

        for (j = EP2I(USB_DIR_IN); j < MAX_ENDPOINTS; j++) {
            if (dev->endpoint[j].interface ==
                                    dev->interface_info.interface[i] &&
                    dev->endpoint[j].type == USB_ENDPOINT_XFER_BULK &&
                    dev->endpoint[j].max_packet_size != 0) {
                dev->endpoint[j].bulk_receiving_enabled = 1;
                 
                I2USBEP(dev, j)->pipeline = false;
                break;  
            }
        }
    }
}