From ff54c47e64d47d5bdf7f0a71d442ef5372cd0d2d Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Sun, 27 Jan 2019 09:48:29 -0600 Subject: [PATCH] Follow up the kernel signal-related change in: examples/oneshot/oneshot_main.c: examples/alarm/alarm_main.c: examples/ajoystick/ajoy_main.c examples/djoystick/djoy_main.c examples/buttons/buttons_main.c examples/zerocross/zerocross_main.c graphics/traveler/src/trv_input.c graphics/ft80x/ --- examples/ajoystick/ajoy_main.c | 4 +++- examples/alarm/alarm_main.c | 5 +++-- examples/buttons/buttons_main.c | 4 +++- examples/djoystick/djoy_main.c | 4 +++- examples/oneshot/oneshot_main.c | 6 ++++-- examples/timer/timer_main.c | 6 ++++-- examples/zerocross/zerocross_main.c | 7 ++++--- graphics/ft80x/ft80x_ramcmd.c | 6 ++++-- graphics/ft80x/ft80x_touch.c | 6 ++++-- graphics/traveler/src/trv_input.c | 8 ++++++-- 10 files changed, 38 insertions(+), 18 deletions(-) diff --git a/examples/ajoystick/ajoy_main.c b/examples/ajoystick/ajoy_main.c index 6233a6dd5..1fea5aa56 100644 --- a/examples/ajoystick/ajoy_main.c +++ b/examples/ajoystick/ajoy_main.c @@ -420,7 +420,9 @@ int ajoy_main(int argc, char *argv[]) notify.an_press = g_ajoysupported; notify.an_release = g_ajoysupported; - notify.an_signo = CONFIG_EXAMPLES_AJOYSTICK_SIGNO; + + notify.an_event.sigev_notify = SIGEV_SIGNAL; + notify.an_event.sigev_signo = CONFIG_EXAMPLES_AJOYSTICK_SIGNO; ret = ioctl(fd, AJOYIOC_REGISTER, (unsigned long)((uintptr_t)¬ify)); if (ret < 0) diff --git a/examples/alarm/alarm_main.c b/examples/alarm/alarm_main.c index be8ce31ca..54b4562c0 100644 --- a/examples/alarm/alarm_main.c +++ b/examples/alarm/alarm_main.c @@ -398,11 +398,12 @@ int alarm_main(int argc, FAR char *argv[]) /* Set the alarm */ setrel.id = alarmid; - setrel.signo = CONFIG_EXAMPLES_ALARM_SIGNO; setrel.pid = g_alarm_daemon_pid; setrel.reltime = (time_t)seconds; - setrel.sigvalue.sival_int = alarmid; + setrel.event.sigev_notify = SIGEV_SIGNAL; + setrel.event.sigev_signo = CONFIG_EXAMPLES_ALARM_SIGNO; + setrel.event.sigev_value.sival_int = alarmid; ret = ioctl(fd, RTC_SET_RELATIVE, (unsigned long)((uintptr_t)&setrel)); if (ret < 0) diff --git a/examples/buttons/buttons_main.c b/examples/buttons/buttons_main.c index 0d1860ce8..cb577a0d5 100644 --- a/examples/buttons/buttons_main.c +++ b/examples/buttons/buttons_main.c @@ -224,7 +224,9 @@ static int button_daemon(int argc, char *argv[]) btnevents.bn_press = supported; btnevents.bn_release = supported; - btnevents.bn_signo = CONFIG_EXAMPLES_BUTTONS_SIGNO; + + btnevents.bn_event.sigev_notify = SIGEV_SIGNAL; + btnevents.bn_event.sigev_signo = CONFIG_EXAMPLES_BUTTONS_SIGNO; /* Register to receive a signal when buttons are pressed/released */ diff --git a/examples/djoystick/djoy_main.c b/examples/djoystick/djoy_main.c index ecc2704f5..92bce8afe 100644 --- a/examples/djoystick/djoy_main.c +++ b/examples/djoystick/djoy_main.c @@ -183,7 +183,9 @@ int djoy_main(int argc, char *argv[]) notify.dn_press = g_djoysupported; notify.dn_release = g_djoysupported; - notify.dn_signo = CONFIG_EXAMPLES_DJOYSTICK_SIGNO; + + notify.dn_event.sigev_notify = SIGEV_SIGNAL; + notify.dn_event.sigev_signo = CONFIG_EXAMPLES_DJOYSTICK_SIGNO; ret = ioctl(fd, DJOYIOC_REGISTER, (unsigned long)((uintptr_t)¬ify)); if (ret < 0) diff --git a/examples/oneshot/oneshot_main.c b/examples/oneshot/oneshot_main.c index 632c2bf8c..a99c4b177 100644 --- a/examples/oneshot/oneshot_main.c +++ b/examples/oneshot/oneshot_main.c @@ -202,8 +202,6 @@ int oneshot_main(int argc, char *argv[]) usecs); start.pid = 0; - start.signo = CONFIG_EXAMPLES_ONESHOT_SIGNO; - start.arg = NULL; secs = usecs / 1000000; usecs -= 1000000 * secs; @@ -211,6 +209,10 @@ int oneshot_main(int argc, char *argv[]) start.ts.tv_sec = secs; start.ts.tv_nsec = usecs * 1000; + start.event.sigev_notify = SIGEV_SIGNAL; + start.event.sigev_signo = CONFIG_EXAMPLES_ONESHOT_SIGNO; + start.event.sigev_value.sival_ptr = NULL; + /* Zero usecs to terminate the loop */ usecs = 0; diff --git a/examples/timer/timer_main.c b/examples/timer/timer_main.c index dfde53a0a..0f9a5b0dc 100644 --- a/examples/timer/timer_main.c +++ b/examples/timer/timer_main.c @@ -209,9 +209,11 @@ int timer_main(int argc, char *argv[]) printf("Attach timer handler\n"); - notify.arg = NULL; notify.pid = getpid(); - notify.signo = CONFIG_EXAMPLES_TIMER_SIGNO; + + notify.event.sigev_notify = SIGEV_SIGNAL; + notify.event.sigev_signo = CONFIG_EXAMPLES_TIMER_SIGNO; + notify.event.sigev_value.sival_ptr = NULL; ret = ioctl(fd, TCIOC_NOTIFICATION, (unsigned long)((uintptr_t)¬ify)); if (ret < 0) diff --git a/examples/zerocross/zerocross_main.c b/examples/zerocross/zerocross_main.c index cae7b2676..9aeb5ef1e 100644 --- a/examples/zerocross/zerocross_main.c +++ b/examples/zerocross/zerocross_main.c @@ -88,7 +88,7 @@ int main(int argc, FAR char *argv[]) int zerocross_main(int argc, char *argv[]) #endif { - struct zc_notify_s notify; + struct sigevent event; int fd; int tmp; int ret; @@ -106,9 +106,10 @@ int zerocross_main(int argc, char *argv[]) /* Register to receive a signal on every zero cross event */ - notify.zc_signo = CONFIG_EXAMPLES_ZEROCROSS_SIGNO; + event.sigev_notify = SIGEV_SIGNAL; + event.sigev_signo = CONFIG_EXAMPLES_ZEROCROSS_SIGNO; - ret = ioctl(fd, ZCIOC_REGISTER, (unsigned long)((uintptr_t)¬ify)); + ret = ioctl(fd, ZCIOC_REGISTER, (unsigned long)((uintptr_t)&event)); if (ret < 0) { fprintf(stderr, "ERROR: ioctl(ZCIOC_REGISTER) failed: %d\n", errno); diff --git a/graphics/ft80x/ft80x_ramcmd.c b/graphics/ft80x/ft80x_ramcmd.c index 6020e1440..eebbb1fd4 100644 --- a/graphics/ft80x/ft80x_ramcmd.c +++ b/graphics/ft80x/ft80x_ramcmd.c @@ -276,9 +276,11 @@ int ft80x_ramcmd_waitfifoempty(int fd) return ret; } - notify.signo = CONFIG_GRAPHICS_FT80X_CMDEMPTY_SIGNAL; + notify.event.sigev_notify = SIGEV_SIGNAL; + notify.event.sigev_signo = CONFIG_GRAPHICS_FT80X_CMDEMPTY_SIGNAL; + notify.pid = getpid(); - notify.event = FT80X_NOTIFY_CMDEMPTY; + notify.id = FT80X_NOTIFY_CMDEMPTY; notify.enable = false; for (; ; ) diff --git a/graphics/ft80x/ft80x_touch.c b/graphics/ft80x/ft80x_touch.c index 775ef50f9..16d76bfad 100644 --- a/graphics/ft80x/ft80x_touch.c +++ b/graphics/ft80x/ft80x_touch.c @@ -179,9 +179,11 @@ int ft80x_touch_waittag(int fd, uint8_t oldtag) return ret; } - notify.signo = CONFIG_GRAPHICS_FT80X_TAG_SIGNAL; + notify.event.sigev_notify = SIGEV_SIGNAL; + notify.event.sigev_signo = CONFIG_GRAPHICS_FT80X_TAG_SIGNAL; + notify.pid = getpid(); - notify.event = FT80X_NOTIFY_TAG; + notify.id = FT80X_NOTIFY_TAG; notify.enable = false; for (; ; ) diff --git a/graphics/traveler/src/trv_input.c b/graphics/traveler/src/trv_input.c index becf873c3..67520dff1 100644 --- a/graphics/traveler/src/trv_input.c +++ b/graphics/traveler/src/trv_input.c @@ -485,7 +485,9 @@ void trv_input_initialize(void) notify.an_press = BUTTON_SET; notify.an_release = 0; - notify.an_signo = CONFIG_GRAPHICS_TRAVELER_JOYSTICK_SIGNO; + + notify.an_event.sigev_notify = SIGEV_SIGNAL; + notify.an_event.sigev_signo = CONFIG_GRAPHICS_TRAVELER_JOYSTICK_SIGNO; ret = ioctl(g_trv_joystick.fd, AJOYIOC_REGISTER, (unsigned long)((uintptr_t)¬ify)); if (ret < 0) @@ -507,7 +509,9 @@ void trv_input_initialize(void) notify.an_press = 0; notify.an_release = 0; - notify.an_signo = CONFIG_GRAPHICS_TRAVELER_JOYSTICK_SIGNO; + + notify.an_event.sigev_notify = SIGEV_SIGNAL; + notify.an_event.sigev_signo = CONFIG_GRAPHICS_TRAVELER_JOYSTICK_SIGNO; ret = ioctl(g_trv_joystick.fd, AJOYIOC_REGISTER, (unsigned long)((uintptr_t)¬ify)); if (ret < 0)