From 45504ff397103751df3f51799374d8d4555d5c7e Mon Sep 17 00:00:00 2001 From: Michael Ossmann Date: Fri, 23 Sep 2022 06:40:14 -0400 Subject: [PATCH] Don't repeat file that can't advance its position. This avoids a confusing condition when hackrf_transfer is reading from stdin with -R in which it does not repeat previous data but repeatedly restarts reading new data after the user types Ctrl-D to indicate EOF. The -R option should repeat previous data or should do nothing if the input file cannot be rewound. --- host/hackrf-tools/src/hackrf_transfer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/host/hackrf-tools/src/hackrf_transfer.c b/host/hackrf-tools/src/hackrf_transfer.c index 0b15b627..ec4e67a2 100644 --- a/host/hackrf-tools/src/hackrf_transfer.c +++ b/host/hackrf-tools/src/hackrf_transfer.c @@ -543,7 +543,7 @@ int tx_callback(hackrf_transfer* transfer) } /* Otherwise, the file ran short. If not repeating, this is the last data. */ - if (!repeat) { + if ((!repeat) || (ftell(file) < 1)) { tx_complete = true; return 0; }