@ -90,6 +90,7 @@ struct rtlsdr_dev {
int gain ; /* tenth dB */
int gain ; /* tenth dB */
struct e4k_state e4k_s ;
struct e4k_state e4k_s ;
int dev_lost ;
int dev_lost ;
unsigned int xfer_errors ;
} ;
} ;
void rtlsdr_set_gpio_bit ( rtlsdr_dev_t * dev , uint8_t gpio , int val ) ;
void rtlsdr_set_gpio_bit ( rtlsdr_dev_t * dev , uint8_t gpio , int val ) ;
@ -1507,11 +1508,22 @@ static void LIBUSB_CALL _libusb_callback(struct libusb_transfer *xfer)
dev - > cb ( xfer - > buffer , xfer - > actual_length , dev - > cb_ctx ) ;
dev - > cb ( xfer - > buffer , xfer - > actual_length , dev - > cb_ctx ) ;
libusb_submit_transfer ( xfer ) ; /* resubmit transfer */
libusb_submit_transfer ( xfer ) ; /* resubmit transfer */
} else if ( LIBUSB_TRANSFER_CANCELLED ! = xfer - > status & &
dev - > xfer_errors = 0 ;
LIBUSB_TRANSFER_COMPLETED ! = xfer - > status ) {
} else if ( LIBUSB_TRANSFER_CANCELLED ! = xfer - > status ) {
dev - > dev_lost = 1 ;
# ifndef _WIN32
rtlsdr_cancel_async ( dev ) ;
if ( LIBUSB_TRANSFER_ERROR = = xfer - > status )
fprintf ( stderr , " cb transfer status: %d, canceling... \n " , xfer - > status ) ;
dev - > xfer_errors + + ;
if ( dev - > xfer_errors > = dev - > xfer_buf_num | |
LIBUSB_TRANSFER_NO_DEVICE = = xfer - > status ) {
# endif
dev - > dev_lost = 1 ;
rtlsdr_cancel_async ( dev ) ;
fprintf ( stderr , " cb transfer status: %d, "
" canceling... \n " , xfer - > status ) ;
# ifndef _WIN32
}
# endif
}
}
}
}