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>
diff --git a/mainloop.c b/mainloop.c
index 56129aa..04d0ac9 100644
--- a/mainloop.c
+++ b/mainloop.c
@@ -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 @@
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)