static void usbredir_do_attach(void *opaque)
{
    USBRedirDevice *dev = opaque;
    Error *local_err = NULL;

    /* In order to work properly with XHCI controllers we need these caps */
    if ((dev->dev.port->speedmask & USB_SPEED_MASK_SUPER) && !(
        usbredirparser_peer_has_cap(dev->parser,
                                    usb_redir_cap_ep_info_max_packet_size) &&
        usbredirparser_peer_has_cap(dev->parser,
                                    usb_redir_cap_32bits_bulk_length) &&
        usbredirparser_peer_has_cap(dev->parser,
                                    usb_redir_cap_64bits_ids))) {
        ERROR("usb-redir-host lacks capabilities needed for use with XHCI\n");
        usbredir_reject_device(dev);
        return;
    }

    usb_device_attach(&dev->dev, &local_err);
    if (local_err) {
        error_report_err(local_err);
        WARNING("rejecting device due to speed mismatch\n");
        usbredir_reject_device(dev);
    }
}
static void usbredir_do_attach(void *opaque)
{
    USBRedirDevice *dev = opaque;
    Error *local_err = NULL;

     
    if ((dev->dev.port->speedmask & USB_SPEED_MASK_SUPER) && !(
        usbredirparser_peer_has_cap(dev->parser,
                                    usb_redir_cap_ep_info_max_packet_size) &&
        usbredirparser_peer_has_cap(dev->parser,
                                    usb_redir_cap_32bits_bulk_length) &&
        usbredirparser_peer_has_cap(dev->parser,
                                    usb_redir_cap_64bits_ids))) {
        ERROR("usb-redir-host lacks capabilities needed for use with XHCI\n");
        usbredir_reject_device(dev);
        return;
    }

    usb_device_attach(&dev->dev, &local_err);
    if (local_err) {
        error_report_err(local_err);
        WARNING("rejecting device due to speed mismatch\n");
        usbredir_reject_device(dev);
    }
}