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.git
commit 4169842bab328d731db5c65c432b0e82a5d6d115 Author: dongjiuzhu1 <[email protected]> AuthorDate: Tue May 13 12:55:51 2025 +0800 drivers/sensors/sensor_rpmsg: Skip sub broadcast for physical sensors. When a local user subscribes to or unsubscribes from a topic, sensor_rpmsg_open() and sensor_rpmsg_close() broadcast the SUBSCRIBE / UNSUBSCRIBE message to every remote core. For a physical sensor, i.e. a topic whose local driver implements activate(), the data is produced on this core, so remote cores have nothing to do with the message and are only woken up from sleep by it. Send the subscribe and unsubscribe broadcasts only when the local driver has no activate() callback. Signed-off-by: dongjiuzhu1 <[email protected]> --- drivers/sensors/sensor_rpmsg.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/sensors/sensor_rpmsg.c b/drivers/sensors/sensor_rpmsg.c index 6d6761d7519..8607a362436 100644 --- a/drivers/sensors/sensor_rpmsg.c +++ b/drivers/sensors/sensor_rpmsg.c @@ -692,7 +692,12 @@ static int sensor_rpmsg_open(FAR struct sensor_lowerhalf_s *lower, if ((filep->f_oflags & O_ACCMODE) != O_WRONLY) { - if (dev->nsubscribers++ == 0) + /* Send broadcast subscribed info if dev isn't + * physical sensor to avoid waking up remote core. + */ + + if (dev->nsubscribers++ == 0 && + drv->ops->activate == NULL) { sub = true; } @@ -756,7 +761,15 @@ static int sensor_rpmsg_close(FAR struct sensor_lowerhalf_s *lower, { if (dev->nsubscribers == 1) { - unsub = true; + /* Send broadcast unsubscribed info if dev isn't + * physical sensor to avoid waking up remote core. + */ + + if (drv->ops->activate == NULL) + { + unsub = true; + } + list_for_every_entry_safe(&dev->proxylist, proxy, ptmp, struct sensor_rpmsg_proxy_s, node) {
