From 0fd4adef52dee502aeb791100f67ff9fb0bc8ffb Mon Sep 17 00:00:00 2001 From: Felipe Moura Date: Fri, 31 Jul 2026 17:48:04 -0300 Subject: [PATCH] system/uorb: make listener see fetch()-only sensors orb_subscribe_multi() opens the descriptor blocking, so a sensor whose lower half only implements fetch() (no push, e.g. an I2C part with no interrupt line) never satisfies poll()/read() and the listener silently times out with zero messages, indistinguishable from a sensor that has nothing to report. Set O_NONBLOCK after subscribing; sensors that do push samples are unaffected, since neither sensor_poll() nor sensor_read() consults O_NONBLOCK on that path. Signed-off-by: Felipe Moura --- system/uorb/listener.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/system/uorb/listener.c b/system/uorb/listener.c index 2fd1e532d..69dbefcff 100644 --- a/system/uorb/listener.c +++ b/system/uorb/listener.c @@ -200,15 +200,31 @@ static int listener_create_dir(FAR char *dir, size_t size) static int listener_subscribe(FAR struct listen_object_s *tmp, bool nonwakeup) { + int flags; + int fd; + if (nonwakeup) { - return orb_subscribe_multi_nonwakeup(tmp->object.meta, - tmp->object.instance); + fd = orb_subscribe_multi_nonwakeup(tmp->object.meta, + tmp->object.instance); } else { - return orb_subscribe_multi(tmp->object.meta, tmp->object.instance); + fd = orb_subscribe_multi(tmp->object.meta, tmp->object.instance); } + + if (fd < 0) + { + return fd; + } + + flags = fcntl(fd, F_GETFL, 0); + if (flags >= 0) + { + fcntl(fd, F_SETFL, flags | O_NONBLOCK); + } + + return fd; } /****************************************************************************