Skip to content

Instantly share code, notes, and snippets.

@checko
Created December 20, 2012 06:12
Show Gist options
  • Save checko/4343276 to your computer and use it in GitHub Desktop.
Save checko/4343276 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
int main(int argc, char* argv[])
{
int fd;
int err;
char buf;
printf("start!!\n");
while(1) {
fd = open("/sys/power/wait_for_fb_sleep",O_RDONLY,0);
printf("wait_for_fb_sleep\n");
do {
err = read(fd,&buf,1);
} while (err < 0 && errno == EINTR);
close(fd);
printf("suspend\n");
fd = open("/sys/power/wait_for_fb_wake",O_RDONLY,0);
printf("wait_for_fb_wake\n");
do {
err = read(fd, &buf,1);
} while (err < 0 && errno == EINTR);
close(fd);
printf("wakeup\n");
}
printf("Over\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment