hackrf_transfer: Don't skip preload stats in RX
Fixes a bug introduced in 8a9af7a: Statistics skipped for initial buffers not only when preloaded in TX mode but also in RX mode with no preloading. The total bytes transferred may appear inflated in RX mode when receiving a small number of samples with -n, but the stats represent data transferred over USB, some of which may have been discarded by the host.
This commit is contained in:
@ -1249,6 +1249,8 @@ int main(int argc, char** argv)
|
|||||||
result |= hackrf_set_lna_gain(device, lna_gain);
|
result |= hackrf_set_lna_gain(device, lna_gain);
|
||||||
result |= hackrf_start_rx(device, rx_callback, NULL);
|
result |= hackrf_start_rx(device, rx_callback, NULL);
|
||||||
} else {
|
} else {
|
||||||
|
preload_bytes = hackrf_get_transfer_queue_depth(device) *
|
||||||
|
hackrf_get_transfer_buffer_size(device);
|
||||||
result = hackrf_set_txvga_gain(device, txvga_gain);
|
result = hackrf_set_txvga_gain(device, txvga_gain);
|
||||||
result |= hackrf_enable_tx_flush(device, 1);
|
result |= hackrf_enable_tx_flush(device, 1);
|
||||||
result |= hackrf_start_tx(device, tx_callback, NULL);
|
result |= hackrf_start_tx(device, tx_callback, NULL);
|
||||||
@ -1279,9 +1281,6 @@ int main(int argc, char** argv)
|
|||||||
.it_value = {.tv_sec = 1, .tv_usec = 0}};
|
.it_value = {.tv_sec = 1, .tv_usec = 0}};
|
||||||
setitimer(ITIMER_REAL, &interval_timer, NULL);
|
setitimer(ITIMER_REAL, &interval_timer, NULL);
|
||||||
#endif
|
#endif
|
||||||
preload_bytes = hackrf_get_transfer_queue_depth(device) *
|
|
||||||
hackrf_get_transfer_buffer_size(device);
|
|
||||||
|
|
||||||
while ((hackrf_is_streaming(device) == HACKRF_TRUE) && (do_exit == false)) {
|
while ((hackrf_is_streaming(device) == HACKRF_TRUE) && (do_exit == false)) {
|
||||||
uint64_t byte_count_now;
|
uint64_t byte_count_now;
|
||||||
struct timeval time_now;
|
struct timeval time_now;
|
||||||
|
Reference in New Issue
Block a user