Revision 71d71bbd

b/usb-linux.c
775 775
    }
776 776
}
777 777

  
778
/* returns 1 on problem encountered or 0 for success */
779
static int usb_linux_update_endp_table(USBHostDevice *s)
778
static int usb_linux_get_configuration(USBHostDevice *s)
780 779
{
781
    uint8_t *descriptors;
782
    uint8_t devep, type, configuration, alt_interface;
780
    uint8_t configuration;
783 781
    struct usb_ctrltransfer ct;
784
    int interface, ret, length, i;
782
    int ret;
785 783

  
786 784
    ct.bRequestType = USB_DIR_IN;
787 785
    ct.bRequest = USB_REQ_GET_CONFIGURATION;
......
793 791

  
794 792
    ret = ioctl(s->fd, USBDEVFS_CONTROL, &ct);
795 793
    if (ret < 0) {
796
        perror("usb_linux_update_endp_table");
797
        return 1;
794
        perror("usb_linux_get_configuration");
795
        return -1;
798 796
    }
799 797

  
800 798
    /* in address state */
801 799
    if (configuration == 0) {
802
        return 1;
800
        return -1;
803 801
    }
804 802

  
803
    return configuration;
804
}
805

  
806
/* returns 1 on problem encountered or 0 for success */
807
static int usb_linux_update_endp_table(USBHostDevice *s)
808
{
809
    uint8_t *descriptors;
810
    uint8_t devep, type, configuration, alt_interface;
811
    struct usb_ctrltransfer ct;
812
    int interface, ret, length, i;
813

  
814
    i = usb_linux_get_configuration(s);
815
    if (i < 0)
816
        return 1;
817
    configuration = i;
818

  
805 819
    /* get the desired configuration, interface, and endpoint descriptors
806 820
     * from device description */
807 821
    descriptors = &s->descr[18];

Also available in: Unified diff