From 68fdab2ba1b7bef73fd9a663b4edc50325072ece Mon Sep 17 00:00:00 2001 From: hanzj Date: Fri, 5 Jun 2026 19:41:14 +0800 Subject: [PATCH] system/uorb: fix listener_top not showing topic data listener_update() only prints topic data when delta_generation is non-zero (i.e., new data arrived since last check). In listener_top, the first call adds objects to the list, and subsequent calls only print if new data was published between iterations. This results in listener_top -T showing only the header with no topic rows. Fix by always printing the current topic state in listener_update, setting frequency to 0 when no new data arrives. This ensures listener_top displays all topics every iteration. Fixes apache/nuttx-apps#3202 Signed-off-by: hanzj --- system/uorb/listener.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/system/uorb/listener.c b/system/uorb/listener.c index 4a60b518573..e228f7daa84 100644 --- a/system/uorb/listener.c +++ b/system/uorb/listener.c @@ -330,24 +330,25 @@ static int listener_update(FAR struct listen_list_s *objlist, delta_time = now_time - old->timestamp; delta_generation = state.generation - old->generation; + + unsigned long frequency = 0; if (delta_generation && delta_time) { - unsigned long frequency; - frequency = (state.max_frequency ? state.max_frequency : 1000000) * delta_generation / delta_time; - uorbinfo_raw("\033[K" "%-*s %2u %4" PRIu32 " %4lu " - "%2" PRIu32 " %4u", - ORB_MAX_PRINT_NAME, - object->meta->o_name, - object->instance, - state.nsubscribers, - frequency, - state.queue_size, - object->meta->o_size); - old->generation = state.generation; - old->timestamp = now_time; } + + uorbinfo_raw("\033[K" "%-*s %2u %4" PRIu32 " %4lu " + "%2" PRIu32 " %4u", + ORB_MAX_PRINT_NAME, + object->meta->o_name, + object->instance, + state.nsubscribers, + frequency, + state.queue_size, + object->meta->o_size); + old->generation = state.generation; + old->timestamp = now_time; } else {