From 65c7b5aa24e8e9e5dda1c5897be38fac05143d8d Mon Sep 17 00:00:00 2001 From: Dominic Spill Date: Tue, 27 Feb 2018 16:07:04 -0700 Subject: [PATCH] Open device counting: increment when opening a device Previously it incremented when the library was initialised, this worked for GNU Radio flowgraphs, but broke elsewhere --- host/libhackrf/src/hackrf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/host/libhackrf/src/hackrf.c b/host/libhackrf/src/hackrf.c index f097f92b..1bf45749 100644 --- a/host/libhackrf/src/hackrf.c +++ b/host/libhackrf/src/hackrf.c @@ -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; }