From e031af0665be9f368401abbe461c39953a8e672b Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 11 Mar 2026 15:33:43 +0100 Subject: [PATCH 1/2] USRP: usrp-tx-write-thread: return number of samples written At least writerProcessWaitingQueue() checks for the exact number of samples written. In many other places, we check that the return is non-zero. The usrp-tx-write-thread functionality returned 0, which triggers various problems. Return the number of samples, as in the "direct write" case (if-block before else-block). Co-authored-by: Sagar Arora --- radio/USRP/usrp_lib.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/USRP/usrp_lib.cpp b/radio/USRP/usrp_lib.cpp index f224b75354..7cd0f47ee0 100644 --- a/radio/USRP/usrp_lib.cpp +++ b/radio/USRP/usrp_lib.cpp @@ -553,7 +553,7 @@ static int trx_usrp_write(openair0_device_t *device, LOG_D(HW, "Signaling TX TS %llu\n", (unsigned long long)timestamp); pthread_cond_signal(&write_thread->cond_write); pthread_mutex_unlock(&write_thread->mutex_write); - return 0; + return nsamps; } } From 61b3f3b5b4160fa4d7c1646e35895fe7d1ab70d9 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 11 Mar 2026 15:45:53 +0100 Subject: [PATCH 2/2] Update RF failed to write warning, add for harmonization The original error was simply "failed to write to RF", which is not very precise. Update with sample numbers for context, and add it in another similar case for consistency. Co-authored-by: Sagar Arora --- radio/COMMON/common_lib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/radio/COMMON/common_lib.c b/radio/COMMON/common_lib.c index 4720347f20..5e12d11e2b 100644 --- a/radio/COMMON/common_lib.c +++ b/radio/COMMON/common_lib.c @@ -217,7 +217,7 @@ static void writerProcessWaitingQueue(nrue_ru_write_t nrue_ru_write, PHY_VARS_NR else wroteSamples = device->trx_write_func(device, timestamp, txp, nsamps, nbAnt, flags); if (wroteSamples != nsamps) - LOG_E(HW, "Failed to write to rf\n"); + LOG_W(HW, "Failed to write to RF: wrote %d out of %d samples\n", wroteSamples, nsamps); } ctx->nextTS = timestamp + nsamps; pthread_mutex_lock(&ctx->mutex_store); @@ -258,6 +258,8 @@ int openair0_write_reorder_common(nrue_ru_write_t nrue_ru_write, wroteSamples = nrue_ru_write(UE, timestamp, txp, nsamps, nbAnt, flags); else wroteSamples = device->trx_write_func(device, timestamp, txp, nsamps, nbAnt, flags); + if (wroteSamples != nsamps) + LOG_W(HW, "Failed to write to RF: wrote %d out of %d samples\n", wroteSamples, nsamps); } else wroteSamples = nsamps; ctx->nextTS = timestamp + nsamps;