When boardctl() fails, need to print errno not the returned value which will always be -1.
This commit is contained in:
parent
5bdacd2f17
commit
3e01a06431
@ -252,9 +252,9 @@ int adc_main(int argc, char *argv[])
|
||||
|
||||
printf("adc_main: Initializing external ADC device\n");
|
||||
ret = boardctl(BOARDIOC_ADCTEST_SETUP, 0);
|
||||
if (ret != OK)
|
||||
if (ret < 0)
|
||||
{
|
||||
printf("adc_main: boardctl failed: %d\n", ret);
|
||||
printf("adc_main: boardctl failed: %d\n", errno);
|
||||
errval = 1;
|
||||
goto errout;
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ int pwm_main(int argc, char *argv[])
|
||||
ret = boardctl(BOARDIOC_PWMTEST_SETUP, 0);
|
||||
if (ret != OK)
|
||||
{
|
||||
printf("pwm_main: boardctl failed: %d\n", ret);
|
||||
printf("pwm_main: boardctl failed: %d\n", errno);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* examples/touchscreen/tc_main.c
|
||||
*
|
||||
* Copyright (C) 2011, 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011, 2014-2025 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -134,7 +134,7 @@ int tc_main(int argc, char *argv[])
|
||||
ret = boardctl(BOARDIOC_TSCTEST_SETUP, CONFIG_EXAMPLES_TOUCHSCREEN_MINOR);
|
||||
if (ret != OK)
|
||||
{
|
||||
printf("tc_main: board_tsc_setup failed: %d\n", ret);
|
||||
printf("tc_main: board_tsc_setup failed: %d\n", errno);
|
||||
errval = 1;
|
||||
goto errout;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user