From bdac8c116a2b98550424ee4ebceefb30f1891f58 Mon Sep 17 00:00:00 2001 From: likun17 Date: Fri, 8 Mar 2024 16:35:51 +0800 Subject: [PATCH] sensor_rpmsg.c: Fix that "stub" will be created when local core only has subscribers. After the ap core subscribes to the 25hz batch 120ms data of the sensor core, it switches to the cp core and subscribes to the 50hz batch 120ms sensor core data. At this time, the data subscribed by the AP will be abnormally lost (12.5hz). Mainly because ap subscribes to sensor core data earlier than cp. The subscription of cp will be broadcast to the ap core at the same time, and the corresponding "path" already exists under "/dev/uorb" of ap. Thus the ap will create a "stub". There are some restrictions on the creation of "stub" to avoid this situation. Signed-off-by: likun17 --- drivers/sensors/sensor_rpmsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/sensors/sensor_rpmsg.c b/drivers/sensors/sensor_rpmsg.c index d7a7a18cad..232c2be122 100644 --- a/drivers/sensors/sensor_rpmsg.c +++ b/drivers/sensors/sensor_rpmsg.c @@ -1049,7 +1049,7 @@ static int sensor_rpmsg_sub_handler(FAR struct rpmsg_endpoint *ept, int ret; dev = sensor_rpmsg_find_dev(msg->path); - if (!dev) + if (!dev || (dev->nadvertisers == 0 && !dev->lower.persist)) { return 0; }