|
|
@ -195,7 +195,10 @@ sigterm() |
|
|
|
{ |
|
|
|
{ |
|
|
|
state = StateDead; |
|
|
|
state = StateDead; |
|
|
|
syncstate(); |
|
|
|
syncstate(); |
|
|
|
if (wakeinterval) close(rtc_fd); |
|
|
|
if (wakeinterval) { |
|
|
|
|
|
|
|
ioctl(rtc_fd, RTC_AIE_OFF, 0); |
|
|
|
|
|
|
|
close(rtc_fd); |
|
|
|
|
|
|
|
} |
|
|
|
fprintf(stderr, "Screenlock terminating on signal\n"); |
|
|
|
fprintf(stderr, "Screenlock terminating on signal\n"); |
|
|
|
exit(0); |
|
|
|
exit(0); |
|
|
|
} |
|
|
|
} |
|
|
@ -474,6 +477,7 @@ void usage() { |
|
|
|
void init_rtc() { |
|
|
|
void init_rtc() { |
|
|
|
rtc_fd = open(RTC_DEVICE, O_RDONLY); |
|
|
|
rtc_fd = open(RTC_DEVICE, O_RDONLY); |
|
|
|
if (rtc_fd < 0) { |
|
|
|
if (rtc_fd < 0) { |
|
|
|
|
|
|
|
fprintf(stderr, "Error opening rtc device: %d\n", rtc_fd); |
|
|
|
die("Unable to open rtc device"); |
|
|
|
die("Unable to open rtc device"); |
|
|
|
exit(EXIT_FAILURE); |
|
|
|
exit(EXIT_FAILURE); |
|
|
|
} |
|
|
|
} |
|
|
@ -522,6 +526,8 @@ main(int argc, char **argv) { |
|
|
|
if (!(dpy = XOpenDisplay(NULL))) |
|
|
|
if (!(dpy = XOpenDisplay(NULL))) |
|
|
|
die("Cannot open display"); |
|
|
|
die("Cannot open display"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getoldbrightness(); |
|
|
|
|
|
|
|
|
|
|
|
if (wakeinterval) init_rtc(); |
|
|
|
if (wakeinterval) init_rtc(); |
|
|
|
|
|
|
|
|
|
|
|
fprintf(stderr, "Screenlock starting\n"); |
|
|
|
fprintf(stderr, "Screenlock starting\n"); |
|
|
@ -529,7 +535,6 @@ main(int argc, char **argv) { |
|
|
|
XkbSetDetectableAutoRepeat(dpy, True, NULL); |
|
|
|
XkbSetDetectableAutoRepeat(dpy, True, NULL); |
|
|
|
screen = XDefaultScreen(dpy); |
|
|
|
screen = XDefaultScreen(dpy); |
|
|
|
XSync(dpy, 0); |
|
|
|
XSync(dpy, 0); |
|
|
|
getoldbrightness(); |
|
|
|
|
|
|
|
syncstate(); |
|
|
|
syncstate(); |
|
|
|
lockscreen(dpy, screen, target == StateNoInputNoScreen || target == StateSuspend); |
|
|
|
lockscreen(dpy, screen, target == StateNoInputNoScreen || target == StateSuspend); |
|
|
|
if ((target == StateNoInputNoScreen) || (target == StateSuspend)) { |
|
|
|
if ((target == StateNoInputNoScreen) || (target == StateSuspend)) { |
|
|
|