aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2016-02-19 21:16:43 +0000
committerDaniel Lezcano <daniel.lezcano@linaro.org>2016-02-19 21:16:43 +0000
commit32e6cb5940cb92370639c0a840b6f4622f280657 (patch)
treec60474fddac6039431fc5410890a8c707f8edcf9
parent5e659d7bfaf5c46dcff93d63c8252bf11d179c37 (diff)
downloadpowerdebug-32e6cb5940cb92370639c0a840b6f4622f280657.tar.gz
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.c12
-rw-r--r--powerdebug.h4
2 files changed, 14 insertions, 2 deletions
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 @@ 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)