Skip to content

Commit

Permalink
Use device->stop_requested when libusb errors out (#76)
Browse files Browse the repository at this point in the history
Replace device->streaming = false with device->stop_requested = true for
USB errors to avoid deadlock on device removal. Also check
stop_requested when checking if streaming or not to be consistent with
the old behaviour.
  • Loading branch information
johanhedin authored May 16, 2021
1 parent 229d5a5 commit 3f23328
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libairspy/src/airspy.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,12 +477,12 @@ static void airspy_libusb_transfer_callback(struct libusb_transfer* usb_transfer

if (libusb_submit_transfer(usb_transfer) != 0)
{
device->streaming = false;
device->stop_requested = true;
}
}
else
{
device->streaming = false;
device->stop_requested = true;
}
}

Expand All @@ -504,7 +504,7 @@ static void* transfer_threadproc(void* arg)
if (error < 0)
{
if (error != LIBUSB_ERROR_INTERRUPTED)
device->streaming = false;
device->stop_requested = true;
}
}

Expand Down Expand Up @@ -1872,7 +1872,7 @@ int airspy_list_devices(uint64_t *serials, int count)

int ADDCALL airspy_is_streaming(airspy_device_t* device)
{
return device->streaming == true;
return (device->streaming == true && device->stop_requested == false);
}

const char* ADDCALL airspy_error_name(enum airspy_error errcode)
Expand Down

0 comments on commit 3f23328

Please sign in to comment.