Revision c3268cc1 hw/usb/host-libusb.c

b/hw/usb/host-libusb.c
667 667

  
668 668
/* ------------------------------------------------------------------------ */
669 669

  
670
static bool usb_host_full_speed_compat(USBHostDevice *s)
671
{
672
    struct libusb_config_descriptor *conf;
673
    const struct libusb_interface_descriptor *intf;
674
    const struct libusb_endpoint_descriptor *endp;
675
    uint8_t type;
676
    int rc, c, i, a, e;
677

  
678
    for (c = 0;; c++) {
679
        rc = libusb_get_config_descriptor(s->dev, c, &conf);
680
        if (rc != 0) {
681
            break;
682
        }
683
        for (i = 0; i < conf->bNumInterfaces; i++) {
684
            for (a = 0; a < conf->interface[i].num_altsetting; a++) {
685
                intf = &conf->interface[i].altsetting[a];
686
                for (e = 0; e < intf->bNumEndpoints; e++) {
687
                    endp = &intf->endpoint[e];
688
                    type = endp->bmAttributes & 0x3;
689
                    switch (type) {
690
                    case 0x01: /* ISO */
691
                        return false;
692
                    case 0x03: /* INTERRUPT */
693
                        if (endp->wMaxPacketSize > 64) {
694
                            return false;
695
                        }
696
                        break;
697
                    }
698
                }
699
            }
700
        }
701
        libusb_free_config_descriptor(conf);
702
    }
703
    return true;
704
}
705

  
670 706
static void usb_host_ep_update(USBHostDevice *s)
671 707
{
672 708
    static const char *tname[] = {
......
758 794

  
759 795
    udev->speed     = speed_map[libusb_get_device_speed(dev)];
760 796
    udev->speedmask = (1 << udev->speed);
761
#if 0
762
    if (udev->speed == USB_SPEED_HIGH && usb_linux_full_speed_compat(dev)) {
797
    if (udev->speed == USB_SPEED_HIGH && usb_host_full_speed_compat(s)) {
763 798
        udev->speedmask |= USB_SPEED_MASK_FULL;
764 799
    }
765
#endif
766 800

  
767 801
    if (s->ddesc.iProduct) {
768 802
        libusb_get_string_descriptor_ascii(s->dh, s->ddesc.iProduct,

Also available in: Unified diff