Skip to content

Commit

Permalink
Merge pull request greatscottgadgets#460 from dominicgs/device_counti…
Browse files Browse the repository at this point in the history
…ng_fix

Open device counting: increment when opening a device
  • Loading branch information
mossmann authored Mar 21, 2018
2 parents 370ee2d + 65c7b5a commit d7e2068
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions host/libhackrf/src/hackrf.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ extern "C"
int ADDCALL hackrf_init(void)
{
int libusb_error;
open_devices++;
if (g_libusb_context != NULL) {
return HACKRF_SUCCESS;
}
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit d7e2068

Please sign in to comment.