add 10ms sleep after stop
This seems to stop consumers that are doing quick back to back stop/start (eg gqrx changing decode mode / filter bandwidth) from hanging the device. I now don't have any weird hangs on hackrf with gqrx/freebsd/libusb! When things hang it isn't erroring out in any way; it just doesn't start receive. It doesn't look like a libusb issue; I'd have to get some USB bus sniffing to see what's going on behind the scenes.
This commit is contained in:
@ -25,6 +25,9 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSI
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#ifndef _WIN32
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
#include <libusb.h>
|
#include <libusb.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -1688,6 +1691,11 @@ int ADDCALL hackrf_stop_rx(hackrf_device* device)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = hackrf_set_transceiver_mode(device, HACKRF_TRANSCEIVER_MODE_OFF);
|
result = hackrf_set_transceiver_mode(device, HACKRF_TRANSCEIVER_MODE_OFF);
|
||||||
|
#ifdef _WIN32
|
||||||
|
Sleep(10);
|
||||||
|
#else
|
||||||
|
usleep(10 * 1000);
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1717,6 +1725,11 @@ int ADDCALL hackrf_stop_tx(hackrf_device* device)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = hackrf_set_transceiver_mode(device, HACKRF_TRANSCEIVER_MODE_OFF);
|
result = hackrf_set_transceiver_mode(device, HACKRF_TRANSCEIVER_MODE_OFF);
|
||||||
|
#ifdef _WIN32
|
||||||
|
Sleep(10);
|
||||||
|
#else
|
||||||
|
usleep(10 * 1000);
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user