mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-08 22:17:23 +00:00
test/sensor: fix test failed when some apis are NULL
N/A Change-Id: Ieb40b3ce73240057a181ee0dd482564cf27f6afa Signed-off-by: dongjiuzhu <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
6189a8df4b
commit
a96867a65d
1 changed files with 18 additions and 9 deletions
|
|
@ -258,27 +258,36 @@ int main(int argc, FAR char *argv[])
|
|||
if (ret < 0)
|
||||
{
|
||||
ret = -errno;
|
||||
printf("Failed to enable sensor:%s, ret:%s\n",
|
||||
devname, strerror(errno));
|
||||
goto ctl_err;
|
||||
if (ret != -ENOTTY)
|
||||
{
|
||||
printf("Failed to enable sensor:%s, ret:%s\n",
|
||||
devname, strerror(errno));
|
||||
goto ctl_err;
|
||||
}
|
||||
}
|
||||
|
||||
ret = ioctl(fd, SNIOC_SET_INTERVAL, &interval);
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = -errno;
|
||||
snerr("Failed to set interval for sensor:%s, ret:%s\n",
|
||||
devname, strerror(errno));
|
||||
goto ctl_err;
|
||||
if (ret != -ENOTTY)
|
||||
{
|
||||
printf("Failed to set interval for sensor:%s, ret:%s\n",
|
||||
devname, strerror(errno));
|
||||
goto ctl_err;
|
||||
}
|
||||
}
|
||||
|
||||
ret = ioctl(fd, SNIOC_BATCH, &latency);
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = -errno;
|
||||
snerr("Failed to batch for sensor:%s, ret:%s\n",
|
||||
devname, strerror(errno));
|
||||
goto ctl_err;
|
||||
if (ret != -ENOTTY)
|
||||
{
|
||||
printf("Failed to batch for sensor:%s, ret:%s\n",
|
||||
devname, strerror(errno));
|
||||
goto ctl_err;
|
||||
}
|
||||
}
|
||||
|
||||
printf("SensorTest: Test %s with interval(%uus), latency(%uus)\n",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue