fix for calling postwake script after wakeup #130

master
Maarten van Gompel 4 years ago
parent 6ce40b7daf
commit 6750e3e47b
  1. 4
      programs/sxmo_screenlock.c

@ -63,6 +63,7 @@ char * powerstatefile = "/sys/power/state";
int rtc_fd = 0; //file descriptor int rtc_fd = 0; //file descriptor
time_t wakeinterval = 0; //wake every x seconds time_t wakeinterval = 0; //wake every x seconds
time_t waketime = 0; //next wakeup time according to the RTC clock time_t waketime = 0; //next wakeup time according to the RTC clock
int slept = 0; //indicates whether the process has slept (crust) or not
#define RTC_DEVICE "/dev/rtc0" #define RTC_DEVICE "/dev/rtc0"
@ -278,6 +279,7 @@ readinputloop(Display *dpy, int screen) {
lastkeyn = 0; lastkeyn = 0;
lastkeysym = XK_Cancel; lastkeysym = XK_Cancel;
if (slept) postwake();
switch (keysym) { switch (keysym) {
case XF86XK_AudioRaiseVolume: case XF86XK_AudioRaiseVolume:
suspendpendingsceenon = state == StateNoInput; suspendpendingsceenon = state == StateNoInput;
@ -337,6 +339,7 @@ void
postwake() { postwake() {
//called after fully waking up (not used for temporary rtc wakeups) //called after fully waking up (not used for temporary rtc wakeups)
system("sxmo_postwake.sh"); system("sxmo_postwake.sh");
slept = 0;
} }
int int
@ -366,6 +369,7 @@ syncstate()
if (presuspend() != 0) { if (presuspend() != 0) {
state = StateDead; state = StateDead;
} else { } else {
slept = 1;
setpineled(Red); setpineled(Red);
configuresuspendsettingsandwakeupsources(); configuresuspendsettingsandwakeupsources();
writefile(powerstatefile, "mem"); writefile(powerstatefile, "mem");

Loading…
Cancel
Save