From c8f2f0f262f0c5bd398b768f48b1945b768816c1 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Wed, 11 Nov 2020 10:21:04 +0900 Subject: [PATCH] examples/touchscreen/tc_main.c: Appease nxstyle --- examples/touchscreen/tc_main.c | 158 +++++++++++++++++---------------- 1 file changed, 80 insertions(+), 78 deletions(-) diff --git a/examples/touchscreen/tc_main.c b/examples/touchscreen/tc_main.c index 1074ebcf6..1672d1a31 100644 --- a/examples/touchscreen/tc_main.c +++ b/examples/touchscreen/tc_main.c @@ -109,6 +109,7 @@ int main(int argc, FAR char *argv[]) { nsamples = strtol(argv[1], NULL, 10); } + printf("tc_main: nsamples: %d\n", nsamples); /* Open the touchscreen device for reading */ @@ -127,104 +128,105 @@ int main(int argc, FAR char *argv[]) * touchscreen samples. */ - for (;;) - { - /* Flush any output before the loop entered or from the previous pass - * through the loop. - */ + for (; ; ) + { + /* Flush any output before the loop entered or from the previous pass + * through the loop. + */ - fflush(stdout); + fflush(stdout); #ifdef CONFIG_EXAMPLES_TOUCHSCREEN_MOUSE - /* Read one sample */ + /* Read one sample */ - iinfo("Reading...\n"); - nbytes = read(fd, &sample, sizeof(struct mouse_report_s)); - iinfo("Bytes read: %d\n", nbytes); + iinfo("Reading...\n"); + nbytes = read(fd, &sample, sizeof(struct mouse_report_s)); + iinfo("Bytes read: %d\n", nbytes); - /* Handle unexpected return values */ + /* Handle unexpected return values */ - if (nbytes < 0) - { - errval = errno; - if (errval != EINTR) - { - printf("tc_main: read %s failed: %d\n", - CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH, errval); - errval = 3; - goto errout_with_dev; - } + if (nbytes < 0) + { + errval = errno; + if (errval != EINTR) + { + printf("tc_main: read %s failed: %d\n", + CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH, errval); + errval = 3; + goto errout_with_dev; + } - printf("tc_main: Interrupted read...\n"); - } - else if (nbytes != sizeof(struct mouse_report_s)) - { - printf("tc_main: Unexpected read size=%d, expected=%d, Ignoring\n", - nbytes, sizeof(struct mouse_report_s)); - } + printf("tc_main: Interrupted read...\n"); + } + else if (nbytes != sizeof(struct mouse_report_s)) + { + printf("tc_main: Unexpected read size=%d, expected=%d, Ignoring\n", + nbytes, sizeof(struct mouse_report_s)); + } - /* Print the sample data on successful return */ + /* Print the sample data on successful return */ - else - { - printf("Sample :\n"); - printf(" buttons : %02x\n", sample.buttons); - printf(" x : %d\n", sample.x); - printf(" y : %d\n", sample.y); + else + { + printf("Sample :\n"); + printf(" buttons : %02x\n", sample.buttons); + printf(" x : %d\n", sample.x); + printf(" y : %d\n", sample.y); #ifdef CONFIG_MOUSE_WHEEL - printf(" wheel : %d\n", sample.wheel); + printf(" wheel : %d\n", sample.wheel); #endif - } + } #else - /* Read one sample */ + /* Read one sample */ - iinfo("Reading...\n"); - nbytes = read(fd, &sample, sizeof(struct touch_sample_s)); - iinfo("Bytes read: %d\n", nbytes); + iinfo("Reading...\n"); + nbytes = read(fd, &sample, sizeof(struct touch_sample_s)); + iinfo("Bytes read: %d\n", nbytes); - /* Handle unexpected return values */ + /* Handle unexpected return values */ - if (nbytes < 0) - { - errval = errno; - if (errval != EINTR) - { - printf("tc_main: read %s failed: %d\n", - CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH, errval); - errval = 3; - goto errout_with_dev; - } + if (nbytes < 0) + { + errval = errno; + if (errval != EINTR) + { + printf("tc_main: read %s failed: %d\n", + CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH, errval); + errval = 3; + goto errout_with_dev; + } - printf("tc_main: Interrupted read...\n"); - } - else if (nbytes != sizeof(struct touch_sample_s)) - { - printf("tc_main: Unexpected read size=%ld, expected=%d, Ignoring\n", - (long)nbytes, sizeof(struct touch_sample_s)); - } + printf("tc_main: Interrupted read...\n"); + } + else if (nbytes != sizeof(struct touch_sample_s)) + { + printf("tc_main: Unexpected read size=%ld, expected=%d, " + "Ignoring\n", + (long)nbytes, sizeof(struct touch_sample_s)); + } - /* Print the sample data on successful return */ + /* Print the sample data on successful return */ - else - { - printf("Sample :\n"); - printf(" npoints : %d\n", sample.npoints); - printf("Point 1 :\n"); - printf(" id : %d\n", sample.point[0].id); - printf(" flags : %02x\n", sample.point[0].flags); - printf(" x : %d\n", sample.point[0].x); - printf(" y : %d\n", sample.point[0].y); - printf(" h : %d\n", sample.point[0].h); - printf(" w : %d\n", sample.point[0].w); - printf(" pressure : %d\n", sample.point[0].pressure); - } + else + { + printf("Sample :\n"); + printf(" npoints : %d\n", sample.npoints); + printf("Point 1 :\n"); + printf(" id : %d\n", sample.point[0].id); + printf(" flags : %02x\n", sample.point[0].flags); + printf(" x : %d\n", sample.point[0].x); + printf(" y : %d\n", sample.point[0].y); + printf(" h : %d\n", sample.point[0].h); + printf(" w : %d\n", sample.point[0].w); + printf(" pressure : %d\n", sample.point[0].pressure); + } #endif - if (nsamples && --nsamples <= 0) - { - break; - } - } + if (nsamples && --nsamples <= 0) + { + break; + } + } errout_with_dev: close(fd);