--- libusb-1.0.19/libusb/os/aix_usb.c 2017-08-17 08:28:40 -0500 +++ libusb-1.0.19p/libusb/os/aix_usb.c 2017-08-17 07:18:14 -0500 @@ -509,7 +509,7 @@ size = LOAD16(desc->wTotalLength); usbi_dbg("aix_get_config_descriptor: length in aix_get_config_descriptor is %d and cdesc_len is %d",size, priv->cdesc_len); ptr = (caddr_t)desc; - for (i = 0; i < idx; i++){ + for (i = 1; i < idx; i++){ desc_next = (PUSBConfigDesc)(ptr + size); size = LOAD16(desc_next->wTotalLength); ptr = (caddr_t)desc_next; @@ -517,7 +517,7 @@ /* Make sure we dont copy more than what is actually present */ size = (size < len) ? size : len; memcpy(buf, (char *)ptr, size); - return (size); + return (size); } int @@ -544,29 +544,29 @@ pdescidx = priv->descriptors; - usbi_dbg("aix_get_config_desc_byvalue: Device: %s Config Value: %d host_endian: %d", - priv->devicename, value, *host_endian); - devdesc = (PUSBDevDesc)pdescidx->pDevDesc; numconfig = devdesc->bNumConfigurations; + usbi_dbg("aix_get_config_desc_byvalue: Device: %s Config Value: %d host_endian: %d numconfig: %d", + priv->devicename, value, *host_endian, numconfig); + desc = (PUSBConfigDesc)priv->configdesc; size = LOAD16(desc->wTotalLength); ptr = (caddr_t)desc; - for (i = 0; i < numconfig; i++){ - desc_next = (PUSBConfigDesc)(ptr + size); - size = LOAD16(desc_next->wTotalLength); - + desc_next = desc; + for (i = 1; i <= numconfig; i++){ if (desc_next->bConfigurationValue == value) break; + desc_next = (PUSBConfigDesc)(ptr + size); + size = LOAD16(desc_next->wTotalLength); ptr = (caddr_t)desc_next; } *buffer = (char *)desc_next; - usbi_dbg("aix_get_config_desc_byvalue: returning withe size: %d ", size); + usbi_dbg("aix_get_config_desc_byvalue: returning with the size: %d ", size); return size; } @@ -849,6 +849,7 @@ int fd = 0; struct aix_pipeio pipeioargs; struct libusb_control_setup *setup; + int rc = 0; memset(&pipeioargs, 0, sizeof(struct aix_pipeio)); @@ -879,8 +880,8 @@ usbi_dbg("\n aix_submit_control_transfer errno 6: %d", errno); - ioctl(dpriv->fd, USBLIB_PIPE_IO, &pipeioargs); - usbi_dbg("\n aix_submit_control_transfer errno 5: %d", errno); + rc = ioctl(dpriv->fd, USBLIB_PIPE_IO, &pipeioargs); + usbi_dbg("\n aix_submit_control_transfer rc: %d", rc); return 0; @@ -1019,6 +1020,7 @@ if (pollfd->revents & POLLERR) { usbi_remove_pollfd(HANDLE_CTX(handle), hpriv->fd); + usbi_dbg("aix_handle_events: before calling disconnect"); usbi_handle_disconnect(handle); usbi_dbg(" POLLERR : %d", pollfd->fd); /* device will still be marked as attached if hotplug monitor thread @@ -1340,7 +1342,7 @@ } else if ( cudv_ptr == NULL) { - sprintf(crit, "parent = 'usb0' and connwhere = '%s'",connwhere); + sprintf(crit, "parent = 'usb0' and connwhere = '%s' and status='1'",connwhere); cudv_ptr1 = (struct CuDv *)odm_get_first(CuDv_CLASS,crit,&cudv); --- libusb-1.0.19/examples/xusb.c 2017-08-17 08:28:40 -0500 +++ libusb-1.0.19p/examples/xusb.c 2017-07-12 04:22:13 -0500 @@ -1003,12 +1003,6 @@ PID = 0; test_mode = USE_GENERIC; - if (((uint8_t*)&endian_test)[0] == 0xBE) { - printf("Despite their natural superiority for end users, big endian\n" - "CPUs are not supported with this program, sorry.\n"); - /*return 0;*/ - } - if (argc >= 2) { for (j = 1; j