Merge pull request #460 from dominicgs/device_counting_fix

Open device counting: increment when opening a device
This commit is contained in:
Michael Ossmann
2018-03-21 15:03:22 -06:00
committed by GitHub

View File

@ -348,7 +348,6 @@ extern "C"
int ADDCALL hackrf_init(void)
{
int libusb_error;
open_devices++;
if (g_libusb_context != NULL) {
return HACKRF_SUCCESS;
}
@ -357,7 +356,6 @@ int ADDCALL hackrf_init(void)
if( libusb_error != 0 )
{
last_libusb_error = libusb_error;
open_devices--;
return HACKRF_ERROR_LIBUSB;
} else {
return HACKRF_SUCCESS;
@ -582,6 +580,7 @@ static int hackrf_open_setup(libusb_device_handle* usb_device, hackrf_device** d
}
*device = lib_device;
open_devices++;
return HACKRF_SUCCESS;
}