summaryrefslogtreecommitdiffstats
path: root/meta/packages/apmd/apmd-3.2.2/workaround.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/apmd/apmd-3.2.2/workaround.patch')
-rw-r--r--meta/packages/apmd/apmd-3.2.2/workaround.patch55
1 files changed, 55 insertions, 0 deletions
diff --git a/meta/packages/apmd/apmd-3.2.2/workaround.patch b/meta/packages/apmd/apmd-3.2.2/workaround.patch
new file mode 100644
index 0000000000..19cf073115
--- /dev/null
+++ b/meta/packages/apmd/apmd-3.2.2/workaround.patch
@@ -0,0 +1,55 @@
1
2#
3# Patch managed by http://www.holgerschurig.de/patcher.html
4#
5
6--- apmd-3.2.2.orig/apmd.c~workaround.patch
7+++ apmd-3.2.2.orig/apmd.c
8@@ -158,6 +158,7 @@
9 static int quiet_bios_batlow; /* = 0 */
10 static int verbosity = DEFAULT_VERBOSITY;
11 static int warn_level = 10;
12+static int sleep_now = 0; /* ntp */
13
14 static uid_t apmd_uid = 0;
15 static int apmd_fd = -1;
16@@ -942,6 +943,12 @@
17 exit(0);
18 }
19
20+/* ntp */
21+static void sig_usr1(int sig)
22+{
23+ sleep_now = 1;
24+}
25+
26 int main(int argc, char **argv)
27 {
28 int c;
29@@ -1151,6 +1158,8 @@
30 openlog("apmd", (verbosity>=LOG_DEBUG)?LOG_PERROR:0 | LOG_PID | LOG_CONS, LOG_DAEMON);
31
32 /* Set up signal handler */
33+ if (signal(SIGUSR1, SIG_IGN) != SIG_IGN)
34+ signal(SIGUSR1, sig_usr1); /* ntp */
35 if (signal(SIGINT, SIG_IGN) != SIG_IGN)
36 signal(SIGINT, sig_handler);
37 if (signal(SIGQUIT, SIG_IGN) != SIG_IGN)
38@@ -1230,9 +1239,16 @@
39
40 for (;;)
41 {
42- int num_events = apm_get_events(apmd_fd, check_interval, events, MAX_EVENTS);
43+ int num_events;
44 int e, a;
45
46+ /* ntp */
47+ if (sleep_now) {
48+ sleep_now = 0;
49+ handle_event(APM_USER_SUSPEND, &apminfo);
50+ }
51+
52+ num_events = apm_get_events(apmd_fd, check_interval, events, MAX_EVENTS);
53 apm_read(&apminfo);
54
55 if (num_events == 0) {