summaryrefslogtreecommitdiffstats
path: root/minuitwrp/events.c
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2015-01-27 18:30:03 +0100
committerDees Troy <dees_troy@teamw.in>2015-01-30 16:11:31 +0100
commite13fa63dc0cc49dc75c9d6b5750c2e7327eaaad8 (patch)
treea96d7985a61f8e93253170cf2fbb633d9e03f728 /minuitwrp/events.c
parentFixed screen flipping for devices where xres_virtual > xres (diff)
downloadandroid_bootable_recovery-e13fa63dc0cc49dc75c9d6b5750c2e7327eaaad8.tar
android_bootable_recovery-e13fa63dc0cc49dc75c9d6b5750c2e7327eaaad8.tar.gz
android_bootable_recovery-e13fa63dc0cc49dc75c9d6b5750c2e7327eaaad8.tar.bz2
android_bootable_recovery-e13fa63dc0cc49dc75c9d6b5750c2e7327eaaad8.tar.lz
android_bootable_recovery-e13fa63dc0cc49dc75c9d6b5750c2e7327eaaad8.tar.xz
android_bootable_recovery-e13fa63dc0cc49dc75c9d6b5750c2e7327eaaad8.tar.zst
android_bootable_recovery-e13fa63dc0cc49dc75c9d6b5750c2e7327eaaad8.zip
Diffstat (limited to 'minuitwrp/events.c')
-rw-r--r--minuitwrp/events.c48
1 files changed, 22 insertions, 26 deletions
diff --git a/minuitwrp/events.c b/minuitwrp/events.c
index f02edd34f..98b3a34ee 100644
--- a/minuitwrp/events.c
+++ b/minuitwrp/events.c
@@ -719,44 +719,40 @@ static int vk_modify(struct ev *e, struct input_event *ev)
return 0;
}
-int ev_get(struct input_event *ev, unsigned dont_wait)
+int ev_get(struct input_event *ev)
{
int r;
unsigned n;
struct timeval curr;
- do {
- gettimeofday(&curr, NULL);
- if(curr.tv_sec - lastInputStat.tv_sec >= 2)
+ gettimeofday(&curr, NULL);
+ if(curr.tv_sec - lastInputStat.tv_sec >= 2)
+ {
+ struct stat st;
+ stat("/dev/input", &st);
+ if (st.st_mtime > lastInputMTime)
{
- struct stat st;
- stat("/dev/input", &st);
- if (st.st_mtime > lastInputMTime)
- {
- LOGI("Reloading input devices\n");
- ev_exit();
- ev_init();
- lastInputMTime = st.st_mtime;
- }
- lastInputStat = curr;
+ printf("Reloading input devices\n");
+ ev_exit();
+ ev_init();
+ lastInputMTime = st.st_mtime;
}
+ lastInputStat = curr;
+ }
- r = poll(ev_fds, ev_count, 0);
+ r = poll(ev_fds, ev_count, 0);
- if(r > 0) {
- for(n = 0; n < ev_count; n++) {
- if(ev_fds[n].revents & POLLIN) {
- r = read(ev_fds[n].fd, ev, sizeof(*ev));
- if(r == sizeof(*ev)) {
- if (!vk_modify(&evs[n], ev))
- return 0;
- }
+ if(r > 0) {
+ for(n = 0; n < ev_count; n++) {
+ if(ev_fds[n].revents & POLLIN) {
+ r = read(ev_fds[n].fd, ev, sizeof(*ev));
+ if(r == sizeof(*ev)) {
+ if (!vk_modify(&evs[n], ev))
+ return 0;
}
}
}
-
- usleep(1000);
- } while(dont_wait == 0);
+ }
return -1;
}