This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 8b4d20e41 system/uorb: fix listener_top not showing topic data
8b4d20e41 is described below

commit 8b4d20e41189d7a66677ae057cee6dfdc9850905
Author: hanzj <[email protected]>
AuthorDate: Fri Jun 5 19:41:14 2026 +0800

    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 <[email protected]>
---
 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 4a60b5185..e228f7daa 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
     {

Reply via email to