Indicate success or failure to flush callback.
This commit is contained in:

committed by
Michael Ossmann

parent
4810d1f992
commit
0becbc6b4a
@ -594,9 +594,11 @@ static void tx_complete_callback(hackrf_transfer* transfer, int success)
|
|||||||
stream_power += sum;
|
stream_power += sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void flush_callback(void* flush_ctx)
|
static void flush_callback(void* flush_ctx, int success)
|
||||||
{
|
{
|
||||||
|
if (success) {
|
||||||
flush_complete = true;
|
flush_complete = true;
|
||||||
|
}
|
||||||
stop_main_loop();
|
stop_main_loop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1770,15 +1770,18 @@ static void* transfer_threadproc(void* arg)
|
|||||||
|
|
||||||
static void LIBUSB_CALL hackrf_libusb_flush_callback(struct libusb_transfer* usb_transfer)
|
static void LIBUSB_CALL hackrf_libusb_flush_callback(struct libusb_transfer* usb_transfer)
|
||||||
{
|
{
|
||||||
// TX buffer is now flushed, so proceed with signalling completion.
|
bool success = usb_transfer->status == LIBUSB_TRANSFER_COMPLETED;
|
||||||
|
|
||||||
|
// All transfers have now ended, so proceed with signalling completion.
|
||||||
hackrf_device* device = (hackrf_device*) usb_transfer->user_data;
|
hackrf_device* device = (hackrf_device*) usb_transfer->user_data;
|
||||||
pthread_mutex_lock(&device->all_finished_lock);
|
pthread_mutex_lock(&device->all_finished_lock);
|
||||||
device->flush = false;
|
device->flush = false;
|
||||||
device->active_transfers = 0;
|
device->active_transfers = 0;
|
||||||
pthread_cond_broadcast(&device->all_finished_cv);
|
pthread_cond_broadcast(&device->all_finished_cv);
|
||||||
pthread_mutex_unlock(&device->all_finished_lock);
|
pthread_mutex_unlock(&device->all_finished_lock);
|
||||||
|
|
||||||
if (device->flush_callback)
|
if (device->flush_callback)
|
||||||
device->flush_callback(device->flush_ctx);
|
device->flush_callback(device->flush_ctx, success);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LIBUSB_CALL
|
static void LIBUSB_CALL
|
||||||
|
@ -229,7 +229,7 @@ typedef struct hackrf_device_list hackrf_device_list_t;
|
|||||||
|
|
||||||
typedef int (*hackrf_sample_block_cb_fn)(hackrf_transfer* transfer);
|
typedef int (*hackrf_sample_block_cb_fn)(hackrf_transfer* transfer);
|
||||||
typedef void (*hackrf_tx_block_complete_cb_fn)(hackrf_transfer* transfer, int);
|
typedef void (*hackrf_tx_block_complete_cb_fn)(hackrf_transfer* transfer, int);
|
||||||
typedef void (*hackrf_flush_cb_fn)(void* flush_ctx);
|
typedef void (*hackrf_flush_cb_fn)(void* flush_ctx, int);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
Reference in New Issue
Block a user