You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/07/26 02:40:44 UTC

[incubator-nuttx-apps] branch master updated: testing/sensor_test: update sensortest according to enhance sensor driver

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

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


The following commit(s) were added to refs/heads/master by this push:
     new a06fa5ac2 testing/sensor_test: update sensortest according to enhance sensor driver
a06fa5ac2 is described below

commit a06fa5ac2708084cd9b28dc68d44c5350e7d8aba
Author: Jiuzhu Dong <do...@xiaomi.com>
AuthorDate: Mon Jul 25 04:08:38 2022 +0000

    testing/sensor_test: update sensortest according to enhance sensor driver
    
    1.update prefix of sensor event structure to sensor_xxx.
    2.remove activate cmd because of open will auto activate sensor.
    
    Signed-off-by: Jiuzhu Dong <do...@xiaomi.com>
---
 testing/sensortest/sensortest.c | 83 +++++++++++++++--------------------------
 1 file changed, 31 insertions(+), 52 deletions(-)

diff --git a/testing/sensortest/sensortest.c b/testing/sensortest/sensortest.c
index 9c8e614bf..3ae8a6cef 100644
--- a/testing/sensortest/sensortest.c
+++ b/testing/sensortest/sensortest.c
@@ -76,37 +76,37 @@ static bool g_should_exit = false;
 
 static const struct sensor_info g_sensor_info[] =
 {
-  {print_vec3,  sizeof(struct sensor_event_accel), "accel"},
-  {print_vec3,  sizeof(struct sensor_event_mag),   "mag"},
-  {print_vec3,  sizeof(struct sensor_event_gyro),  "gyro"},
-  {print_valf2, sizeof(struct sensor_event_baro),  "baro"},
-  {print_valf,  sizeof(struct sensor_event_light), "light"},
-  {print_valf,  sizeof(struct sensor_event_prox),  "prox"},
-  {print_valf,  sizeof(struct sensor_event_humi),  "humi"},
-  {print_valf,  sizeof(struct sensor_event_temp),  "temp"},
-  {print_valf3, sizeof(struct sensor_event_rgb),   "rgb"},
-  {print_valb,  sizeof(struct sensor_event_hall),  "hall"},
-  {print_valf,  sizeof(struct sensor_event_ir),    "ir"},
-  {print_gps,   sizeof(struct sensor_event_gps),   "gps"},
-  {print_valf,  sizeof(struct sensor_event_uv),    "uv"},
-  {print_valf,  sizeof(struct sensor_event_noise), "noise"},
-  {print_valf,  sizeof(struct sensor_event_pm25),  "pm25"},
-  {print_valf,  sizeof(struct sensor_event_pm1p0), "pm1p0"},
-  {print_valf,  sizeof(struct sensor_event_pm10),  "pm10"},
-  {print_valf,  sizeof(struct sensor_event_co2),   "co2"},
-  {print_valf,  sizeof(struct sensor_event_hcho),  "hcho"},
-  {print_valf,  sizeof(struct sensor_event_tvoc),  "tvoc"},
-  {print_valf,  sizeof(struct sensor_event_ph),    "ph"},
-  {print_valf,  sizeof(struct sensor_event_dust),  "dust"},
-  {print_valf,  sizeof(struct sensor_event_hrate), "hrate"},
-  {print_valf,  sizeof(struct sensor_event_hbeat), "hbeat"},
-  {print_valf,  sizeof(struct sensor_event_ecg),   "ecg"},
-  {print_ppgd,  sizeof(struct sensor_event_ppgd),  "ppgd"},
-  {print_ppgq,  sizeof(struct sensor_event_ppgq),  "ppgq"},
-  {print_valf2, sizeof(struct sensor_event_impd),  "impd"},
-  {print_vali2, sizeof(struct sensor_event_ots),   "ots"},
-  {print_gps_satellite,  sizeof(struct sensor_event_gps_satellite),
-                                                   "gps_satellite"}
+  {print_vec3,  sizeof(struct sensor_accel), "accel"},
+  {print_vec3,  sizeof(struct sensor_mag),   "mag"},
+  {print_vec3,  sizeof(struct sensor_gyro),  "gyro"},
+  {print_valf2, sizeof(struct sensor_baro),  "baro"},
+  {print_valf,  sizeof(struct sensor_light), "light"},
+  {print_valf,  sizeof(struct sensor_prox),  "prox"},
+  {print_valf,  sizeof(struct sensor_humi),  "humi"},
+  {print_valf,  sizeof(struct sensor_temp),  "temp"},
+  {print_valf3, sizeof(struct sensor_rgb),   "rgb"},
+  {print_valb,  sizeof(struct sensor_hall),  "hall"},
+  {print_valf,  sizeof(struct sensor_ir),    "ir"},
+  {print_gps,   sizeof(struct sensor_gps),   "gps"},
+  {print_valf,  sizeof(struct sensor_uv),    "uv"},
+  {print_valf,  sizeof(struct sensor_noise), "noise"},
+  {print_valf,  sizeof(struct sensor_pm25),  "pm25"},
+  {print_valf,  sizeof(struct sensor_pm1p0), "pm1p0"},
+  {print_valf,  sizeof(struct sensor_pm10),  "pm10"},
+  {print_valf,  sizeof(struct sensor_co2),   "co2"},
+  {print_valf,  sizeof(struct sensor_hcho),  "hcho"},
+  {print_valf,  sizeof(struct sensor_tvoc),  "tvoc"},
+  {print_valf,  sizeof(struct sensor_ph),    "ph"},
+  {print_valf,  sizeof(struct sensor_dust),  "dust"},
+  {print_valf,  sizeof(struct sensor_hrate), "hrate"},
+  {print_valf,  sizeof(struct sensor_hbeat), "hbeat"},
+  {print_valf,  sizeof(struct sensor_ecg),   "ecg"},
+  {print_ppgd,  sizeof(struct sensor_ppgd),  "ppgd"},
+  {print_ppgq,  sizeof(struct sensor_ppgq),  "ppgq"},
+  {print_valf2, sizeof(struct sensor_impd),  "impd"},
+  {print_vali2, sizeof(struct sensor_ots),   "ots"},
+  {print_gps_satellite,  sizeof(struct sensor_gps_satellite),
+                                              "gps_satellite"}
 };
 
 /****************************************************************************
@@ -349,18 +349,6 @@ int main(int argc, FAR char *argv[])
         }
     }
 
-  ret = ioctl(fd, SNIOC_ACTIVATE, 1);
-  if (ret < 0)
-    {
-      ret = -errno;
-      if (ret != -ENOTSUP)
-        {
-          printf("Failed to enable sensor:%s, ret:%s\n",
-                 devname, strerror(errno));
-          goto ctl_err;
-        }
-    }
-
   printf("SensorTest: Test %s with interval(%uus), latency(%uus)\n",
          devname, interval, latency);
 
@@ -382,15 +370,6 @@ int main(int argc, FAR char *argv[])
   printf("SensorTest: Received message: %s, number:%d/%d\n",
          name, received, count);
 
-  ret = ioctl(fd, SNIOC_ACTIVATE, 0);
-  if (ret < 0)
-    {
-      ret = -errno;
-      printf("Failed to disable sensor:%s, ret:%s\n",
-             devname, strerror(errno));
-      goto ctl_err;
-    }
-
 ctl_err:
   close(fd);
 open_err: