examples/buttons/buttons_main.c: Appease nxstyle

This commit is contained in:
YAMAMOTO Takashi 2020-11-11 09:36:21 +09:00 committed by Xiang Xiao
parent 54cb3ca933
commit 700b10f2aa

View File

@ -186,7 +186,7 @@ static int button_daemon(int argc, char *argv[])
/* Open the BUTTON driver */ /* Open the BUTTON driver */
printf("button_daemon: Opening %s\n", CONFIG_EXAMPLES_BUTTONS_DEVPATH); printf("button_daemon: Opening %s\n", CONFIG_EXAMPLES_BUTTONS_DEVPATH);
fd = open(CONFIG_EXAMPLES_BUTTONS_DEVPATH, O_RDONLY|O_NONBLOCK); fd = open(CONFIG_EXAMPLES_BUTTONS_DEVPATH, O_RDONLY | O_NONBLOCK);
if (fd < 0) if (fd < 0)
{ {
int errcode = errno; int errcode = errno;
@ -207,7 +207,8 @@ static int button_daemon(int argc, char *argv[])
goto errout_with_fd; goto errout_with_fd;
} }
printf("button_daemon: Supported BUTTONs 0x%02x\n", (unsigned int)supported); printf("button_daemon: Supported BUTTONs 0x%02x\n",
(unsigned int)supported);
#ifdef CONFIG_EXAMPLES_BUTTONS_SIGNAL #ifdef CONFIG_EXAMPLES_BUTTONS_SIGNAL
/* Define the notifications events */ /* Define the notifications events */
@ -255,7 +256,8 @@ static int button_daemon(int argc, char *argv[])
if (ret < 0) if (ret < 0)
{ {
int errcode = errno; int errcode = errno;
printf("button_daemon: ERROR: sigwaitinfo() failed: %d\n", errcode); printf("button_daemon: ERROR: sigwaitinfo() failed: %d\n",
errcode);
goto errout_with_fd; goto errout_with_fd;
} }
@ -273,7 +275,8 @@ static int button_daemon(int argc, char *argv[])
timeout = false; timeout = false;
pollin = false; pollin = false;
ret = poll(fds, CONFIG_BUTTONS_NPOLLWAITERS, CONFIG_BUTTONS_POLL_DELAY); ret = poll(fds, CONFIG_BUTTONS_NPOLLWAITERS,
CONFIG_BUTTONS_POLL_DELAY);
printf("\nbutton_daemon: poll returned: %d\n", ret); printf("\nbutton_daemon: poll returned: %d\n", ret);
if (ret < 0) if (ret < 0)
@ -310,12 +313,14 @@ static int button_daemon(int argc, char *argv[])
{ {
if ((fds[i].revents & POLLIN) != 0) if ((fds[i].revents & POLLIN) != 0)
{ {
printf("button_daemon: ERROR no read data[%d]\n", i); printf("button_daemon: ERROR no read data[%d]\n",
i);
} }
} }
else if (errno != EINTR) else if (errno != EINTR)
{ {
printf("button_daemon: read[%d] failed: %d\n", i, errno); printf("button_daemon: read[%d] failed: %d\n", i,
errno);
} }
nbytes = 0; nbytes = 0;
@ -324,12 +329,16 @@ static int button_daemon(int argc, char *argv[])
{ {
if (timeout) if (timeout)
{ {
printf("button_daemon: ERROR? Poll timeout, but data read[%d]\n", i); printf("button_daemon: ERROR? Poll timeout, "
printf(" (might just be a race condition)\n"); "but data read[%d]\n", i);
printf(" (might just be a race "
"condition)\n");
} }
} }
/* Suppress error report if no read data on the next time through */ /* Suppress error report if no read data on the next time
* through
*/
fds[i].revents = 0; fds[i].revents = 0;
} }