diff options
author | Daniel Lezcano <daniel.lezcano@linaro.org> | 2016-02-19 21:16:43 +0000 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2016-02-19 21:16:43 +0000 |
commit | 32e6cb5940cb92370639c0a840b6f4622f280657 (patch) | |
tree | c60474fddac6039431fc5410890a8c707f8edcf9 | |
parent | 5e659d7bfaf5c46dcff93d63c8252bf11d179c37 (diff) |
Fix window refresh.
The window refresh does not work at all. When the mainloop exits, nothing
is done to refresh the current window.
Fix this by sending to ourself a SIGWINCH signal, so the display engine
will automatically catch the signal and refresh the current window.
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
-rw-r--r-- | mainloop.c | 12 | ||||
-rw-r--r-- | powerdebug.h | 4 |
2 files changed, 14 insertions, 2 deletions
@@ -22,6 +22,7 @@ #include <stdlib.h> #include <errno.h> #include <unistd.h> +#include <signal.h> #include <sys/epoll.h> #include "mainloop.h" @@ -56,6 +57,17 @@ int mainloop(unsigned int timeout) return -1; } + /* + * A timeout occured. Let's send to ourself a SIGWINCH + * so the window get refreshed automatically. No need + * to use exported functions and this code stay self + * contained. + */ + if (!nfds) { + kill(getpid(), SIGWINCH); + continue; + } + for (i = 0; i < nfds; i++) { md = events[i].data.ptr; diff --git a/powerdebug.h b/powerdebug.h index 3852ca8..7cf8220 100644 --- a/powerdebug.h +++ b/powerdebug.h @@ -26,8 +26,8 @@ #define CLOCK_OPTION 0x04 #define GPIO_OPTION 0x08 -#define VERBOSE_OPTION 0x10 -#define DUMP_OPTION 0x20 +#define VERBOSE_OPTION 0x1000 +#define DUMP_OPTION 0x2000 #define DEFAULT_OPTION (REGULATOR_OPTION | SENSOR_OPTION | \ CLOCK_OPTION | GPIO_OPTION) |