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 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
a549ea3888
commit
a06fa5ac27
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user