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

commit 00d9af873dfeef2ff453da1b76afd85f8c73b323
Author: likun17 <[email protected]>
AuthorDate: Wed Sep 9 19:34:11 2026 +0800

    system/uorb: add missing metadata for velocity and ambient_temp
    
    SENSOR_TYPE_VELOCITY and SENSOR_TYPE_AMBIENT_TEMPERATURE have an
    entry in the kernel g_sensor_meta[] table but no ORB_DECLARE/ORB_DEFINE
    in user space, so ORB_ID() fails to link, callers must fall back to
    orb_open() by name and lose the o_size check, and uorb_listener cannot
    monitor them.
    Add the missing metadata and register both in g_sensor_list[];
    ambient_temp reuses struct sensor_temp the same way sensor_light_uncal
    already reuses struct sensor_light.
    
    Signed-off-by: likun17 <[email protected]>
---
 system/uorb/sensor/temp.c                 |  1 +
 system/uorb/sensor/temp.h                 |  1 +
 system/uorb/sensor/topics.c               |  3 +++
 system/uorb/sensor/{temp.c => velocity.c} | 12 +++++-------
 system/uorb/sensor/{temp.h => velocity.h} | 10 ++++------
 5 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/system/uorb/sensor/temp.c b/system/uorb/sensor/temp.c
index 63545b312..4a2e2fb93 100644
--- a/system/uorb/sensor/temp.c
+++ b/system/uorb/sensor/temp.c
@@ -40,3 +40,4 @@ static const char sensor_temp_format[] =
  ****************************************************************************/
 
 ORB_DEFINE(sensor_temp, struct sensor_temp, sensor_temp_format);
+ORB_DEFINE(sensor_ambient_temp, struct sensor_temp, sensor_temp_format);
diff --git a/system/uorb/sensor/temp.h b/system/uorb/sensor/temp.h
index 2ee401af3..18067559e 100644
--- a/system/uorb/sensor/temp.h
+++ b/system/uorb/sensor/temp.h
@@ -36,5 +36,6 @@
 /* register this as object request broker structure */
 
 ORB_DECLARE(sensor_temp);
+ORB_DECLARE(sensor_ambient_temp);
 
 #endif
diff --git a/system/uorb/sensor/topics.c b/system/uorb/sensor/topics.c
index 48619627f..2eec67dec 100644
--- a/system/uorb/sensor/topics.c
+++ b/system/uorb/sensor/topics.c
@@ -70,6 +70,7 @@
 #include <sensor/temp.h>
 #include <sensor/tvoc.h>
 #include <sensor/uv.h>
+#include <sensor/velocity.h>
 
 #include <uORB/uORB.h>
 
@@ -81,6 +82,7 @@ static FAR const struct orb_metadata *g_sensor_list[] =
 {
   ORB_ID(sensor_accel),
   ORB_ID(sensor_accel_uncal),
+  ORB_ID(sensor_ambient_temp),
   ORB_ID(sensor_hinge_angle),
   ORB_ID(sensor_baro),
   ORB_ID(sensor_cap),
@@ -139,6 +141,7 @@ static FAR const struct orb_metadata *g_sensor_list[] =
   ORB_ID(sensor_tilt_detector_uncal),
   ORB_ID(sensor_tvoc),
   ORB_ID(sensor_uv),
+  ORB_ID(sensor_velocity),
   ORB_ID(sensor_wake_gesture),
   ORB_ID(sensor_wake_gesture_uncal),
   ORB_ID(sensor_wrist_tilt),
diff --git a/system/uorb/sensor/temp.c b/system/uorb/sensor/velocity.c
similarity index 85%
copy from system/uorb/sensor/temp.c
copy to system/uorb/sensor/velocity.c
index 63545b312..069717386 100644
--- a/system/uorb/sensor/temp.c
+++ b/system/uorb/sensor/velocity.c
@@ -1,7 +1,5 @@
 /****************************************************************************
- * apps/system/uorb/sensor/temp.c
- *
- * SPDX-License-Identifier: Apache-2.0
+ * apps/system/uorb/sensor/velocity.c
  *
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -24,19 +22,19 @@
  * Included Files
  ****************************************************************************/
 
-#include <sensor/temp.h>
+#include <sensor/velocity.h>
 
 /****************************************************************************
  * Private Functions
  ****************************************************************************/
 
 #ifdef CONFIG_UORB_FORMAT
-static const char sensor_temp_format[] =
-  "timestamp:%" PRIu64 ",temperature:%hf";
+static const char sensor_velocity_format[] =
+  "timestamp:%" PRIu64 ",velocity:%hf";
 #endif
 
 /****************************************************************************
  * Public Data
  ****************************************************************************/
 
-ORB_DEFINE(sensor_temp, struct sensor_temp, sensor_temp_format);
+ORB_DEFINE(sensor_velocity, struct sensor_velocity, sensor_velocity_format);
diff --git a/system/uorb/sensor/temp.h b/system/uorb/sensor/velocity.h
similarity index 88%
copy from system/uorb/sensor/temp.h
copy to system/uorb/sensor/velocity.h
index 2ee401af3..aff892c1f 100644
--- a/system/uorb/sensor/temp.h
+++ b/system/uorb/sensor/velocity.h
@@ -1,7 +1,5 @@
 /****************************************************************************
- * apps/system/uorb/sensor/temp.h
- *
- * SPDX-License-Identifier: Apache-2.0
+ * apps/system/uorb/sensor/velocity.h
  *
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -20,8 +18,8 @@
  *
  ****************************************************************************/
 
-#ifndef __APPS_SYSTEM_UORB_SENSOR_TEMP_H
-#define __APPS_SYSTEM_UORB_SENSOR_TEMP_H
+#ifndef __APPS_SYSTEM_UORB_SENSOR_VELOCITY_H
+#define __APPS_SYSTEM_UORB_SENSOR_VELOCITY_H
 
 /****************************************************************************
  * Included Files
@@ -35,6 +33,6 @@
 
 /* register this as object request broker structure */
 
-ORB_DECLARE(sensor_temp);
+ORB_DECLARE(sensor_velocity);
 
 #endif

Reply via email to