@ -2233,10 +2233,9 @@ static int callback_wait(struct cgpu_info *cgpu, struct usb_transfer *ut, int *t
ret = pthread_cond_timedwait ( & ut - > cond , & ut - > mutex , & ts_end ) ;
ret = pthread_cond_timedwait ( & ut - > cond , & ut - > mutex , & ts_end ) ;
if ( ret ) {
if ( ret ) {
/* Assume that if we timed out on the conditional then the
/* Assume that if we timed out on the conditional then the
* transfer has stalled for some reason and attempt to clear
* transfer has stalled for some reason . Cancel the transaction ,
* a halt as a solution . Then cancel the transaction , treating
* treating it the same as a timeout if we receive cancelled as
* it the same as a timeout . */
* the status . */
libusb_clear_halt ( transfer - > dev_handle , transfer - > endpoint ) ;
libusb_cancel_transfer ( transfer ) ;
libusb_cancel_transfer ( transfer ) ;
applog ( LOG_DEBUG , " %s%i: libusb cancelling async bulk transfer " ,
applog ( LOG_DEBUG , " %s%i: libusb cancelling async bulk transfer " ,
cgpu - > drv - > name , cgpu - > device_id ) ;
cgpu - > drv - > name , cgpu - > device_id ) ;
@ -2244,10 +2243,11 @@ static int callback_wait(struct cgpu_info *cgpu, struct usb_transfer *ut, int *t
/* Now wait for the callback function to be invoked. */
/* Now wait for the callback function to be invoked. */
pthread_cond_wait ( & ut - > cond , & ut - > mutex ) ;
pthread_cond_wait ( & ut - > cond , & ut - > mutex ) ;
/* Fake the timed out message since it's effectively that */
}
ret = transfer - > status ;
if ( ret = = LIBUSB_TRANSFER_CANCELLED )
ret = LIBUSB_TRANSFER_TIMED_OUT ;
ret = LIBUSB_TRANSFER_TIMED_OUT ;
} else
ret = transfer - > status ;
/* No need to sort out mutexes here since they won't be reused */
/* No need to sort out mutexes here since they won't be reused */
* transferred = transfer - > actual_length ;
* transferred = transfer - > actual_length ;
libusb_free_transfer ( transfer ) ;
libusb_free_transfer ( transfer ) ;