updated on Thu Jan 26 00:18:00 UTC 2012
[aur-mirror.git] / apmd / apmd-3.0.2.patch
blobad505480cf625718fa0eb1e6668a0a2dc77b3082
1 diff -Naur apmd-orig/Makefile apmd/Makefile
2 --- apmd-orig/Makefile 2001-11-25 14:46:16.000000000 -0800
3 +++ apmd/Makefile 2004-10-27 22:09:11.000000000 -0700
4 @@ -37,8 +37,7 @@
6 CC=gcc
7 CFLAGS=-O -g
8 -XTRACFLAGS=-Wall -pipe -I. -I/usr/src/linux/include \
9 - -I/usr/src/linux-2.2/include -I /usr/src/linux-2.0/include \
10 +XTRACFLAGS=-Wall -pipe -I. -I/usr/linux/include \
11 -DVERSION=\"$(VERSION)\" \
12 -DAPMD_PROXY_NAME=\"$(APMD_PROXY_DIR)/apmd_proxy\"
13 LDFLAGS=
14 diff -Naur apmd-orig/apmd.c apmd/apmd.c
15 --- apmd-orig/apmd.c 2001-11-25 14:43:32.000000000 -0800
16 +++ apmd/apmd.c 2004-10-27 22:09:11.000000000 -0700
17 @@ -67,15 +67,7 @@
18 #include <errno.h>
19 #include <fcntl.h>
21 -#define APM_TRACE 1 /* enable to compile in debug tracing */
24 -#ifdef APM_TRACE
25 -#define ADEBUG(lev,args...) \
26 - if (APM_TRACE>=lev) syslog(LOG_DEBUG, __FUNCTION__ ": " args)
27 -#else
28 -#define ADEBUG(args...)
29 -#endif
30 +#define APM_TRACE 0 /* enable to compile in debug tracing */
32 #define PID_FILE _PATH_VARRUN "apmd.pid"
34 @@ -242,7 +234,6 @@
35 pid_t pid;
36 char line[256];
38 - ADEBUG(4, "0x%04x\n", event);
39 /* If the proxy flag is not set, then return 0 indicating that
40 * the event is acceptable
42 @@ -325,11 +316,9 @@
44 if (pipe(fds))
46 - ADEBUG(0, "can't open fds for apmd_proxy: %s", strerror(errno));
47 return 2;
50 - ADEBUG(1, "executing: '%s' '%s'", argv[0], argv[1]);
52 pid = fork();
53 if (pid == 0) /* child */
54 @@ -354,7 +343,6 @@
56 else if (pid < 0) /* can't fork */
58 - ADEBUG(0, "can't fork for apmd_proxy: %s", strerror(errno));
59 return 1;
61 else if (pid > 0) /* parent */
62 @@ -371,7 +359,6 @@
63 while ((len = read(fds[0], line, sizeof(line)-1)) > 0)
65 line[len] = 0;
66 - ADEBUG(1, "+ %s", line);
69 retval = waitpid(pid, &status, WNOHANG);
70 @@ -379,7 +366,6 @@
71 break; // finished okay
72 if (retval == -1 && errno != EINTR)
74 - ADEBUG(0, "waitpid failed: %s", strerror(errno));
75 status = 143;
76 break;
78 @@ -391,7 +377,6 @@
79 while ((len = read(fds[0], line, sizeof(line)-1)) > 0)
81 line[len] = 0;
82 - ADEBUG(1, "+ %s", line);
85 close(fds[0]);
86 @@ -399,13 +384,10 @@
87 /* Collect the exit code */
88 if (WIFEXITED(status))
90 - ADEBUG(3, "%s exited with status %d", apmd_proxy,
91 - WEXITSTATUS(status));
92 + WEXITSTATUS(status);
93 /* Return the exit status of the program */
94 return WEXITSTATUS(status);
96 - else
97 - ADEBUG(3, "%s exited on signal %d", apmd_proxy, WTERMSIG(status));
100 return 0;
101 @@ -423,7 +405,6 @@
103 char msg[512];
105 - ADEBUG(4, "0x%04x\n", event);
106 if (last_charging_status == apmi->battery_status)
107 return;
109 @@ -460,11 +441,9 @@
111 static int apmd_suspend(apm_event_t event, apm_info * apmi)
113 - ADEBUG(4, "0x%04x\n", event);
114 if (apmd_call_proxy(event, apmi))
116 #ifdef APM_REJECT_ENABLED /* If kernel rejection enabled */
117 - ADEBUG(5, "Suspend rejected\n");
118 return apm_reject(apmd_fd);
119 #endif
121 @@ -494,11 +473,9 @@
123 static int apmd_standby(apm_event_t event, apm_info * apmi)
125 - ADEBUG(4, "0x%04x\n", event);
126 if (apmd_call_proxy(event, apmi))
128 #ifdef APM_REJECT_ENABLED
129 - ADEBUG(5, "Standby rejected\n");
130 return apm_reject(apmd_fd);
131 #endif
133 @@ -529,7 +506,6 @@
134 char msg[512];
135 int len = 0;
137 - ADEBUG(4, "0x%04x\n", event);
138 apmd_call_proxy(event, apmi);
140 /* Logging */
141 @@ -590,7 +566,6 @@
142 static void apmd_low_battery(apm_event_t event, apm_info * apmi)
144 char msg[512];
145 - ADEBUG(4, "0x%04x\n", event);
146 sprintf(msg, "Battery Low Notification from %s (%d%% %s)",
147 (event == APM_LOW_BATTERY ? "APM BIOS" : "apmd"),
148 apmi->battery_percentage, apm_time_nosec(apmd_time(apmi)));
149 @@ -609,7 +584,6 @@
150 static int last_battery_status = 0;
151 static int last_ac_status = -1;
153 - ADEBUG(4, "0x%04x\n", event);
155 /* Call proxy and perform special logging as needed */
156 switch (event)
157 @@ -956,7 +930,6 @@
158 if (apm_read(&apminfo))
159 continue;
160 apmi = &apminfo;
161 - ADEBUG(4, " [event loop] 0x%04x\n", events[i]);
162 if (verbose)
163 syslog(LOG_INFO, "Event 0x%04x: %s",
164 events[i], apm_event_name(events[i]));
165 diff -Naur apmd-orig/apmsleep.c apmd/apmsleep.c
166 --- apmd-orig/apmsleep.c 2001-05-11 13:30:08.000000000 -0700
167 +++ apmd/apmsleep.c 2004-10-27 22:09:11.000000000 -0700
168 @@ -42,14 +42,13 @@
172 +typedef unsigned char u8;
173 +typedef unsigned short u16;
174 +typedef unsigned int u32;
176 #include <stdio.h>
177 #include <linux/version.h>
179 -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,2,0)
180 -#include <asm/spinlock.h>
181 -#endif
183 -#include <linux/mc146818rtc.h>
184 +#include <linux/rtc.h>
185 #include <sys/ioctl.h>
186 #include <sys/time.h>
187 #include <sys/types.h>
188 diff -Naur apmd-orig/on_ac_power apmd/on_ac_power
189 --- apmd-orig/on_ac_power 1999-06-05 15:10:00.000000000 -0700
190 +++ apmd/on_ac_power 2004-10-27 22:09:24.000000000 -0700
191 @@ -16,7 +16,7 @@
192 [ ! -f /proc/apm ] && exit 0;
194 exec awk </proc/apm '
195 - /^[0-9.]* [0-9.]* 0x.. 0x../ {
196 + /^[0-9a-z.]* [0-9a-z.]* 0x.. 0x../ {
197 if ($4 == "0x01")
198 exit 0;
199 else {