summaryrefslogtreecommitdiff
path: root/recipes/apmd/apmd-3.2.2/zaurus24.patch
blob: 5df016ab778b08f7d8b1a5f297badc5ba3ade791 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Index: apmd-3.2.2.orig/apm.c
===================================================================
--- apmd-3.2.2.orig.orig/apm.c	2006-01-26 15:15:27.000000000 +0100
+++ apmd-3.2.2.orig/apm.c	2006-01-26 17:50:14.000000000 +0100
@@ -24,10 +24,12 @@
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/utsname.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <time.h>
 #include <getopt.h>
+#include <signal.h>
 #include "apm.h"
 
 static int verbose = 0;
@@ -43,6 +45,9 @@
     int fd;
     time_t then, now;
     int error;
+    FILE* pid_file;
+    int apmd_pid;
+    struct utsname uname_ver;
 
     fd = open(APM_DEVICE, O_WRONLY);
     if (fd < 0)
@@ -54,6 +59,22 @@
     switch (mode)
     {
     case SUSPEND:
+	if(0 == system("grep -i hardware /proc/cpuinfo|grep -i SHARP"))
+	{
+	    uname(&uname_ver);
+
+	    if(0 == strncmp("2.4", uname_ver.release, 3))
+	    {
+		pid_file = fopen("/var/run/apmd.pid", "r");
+		if(pid_file)
+		{
+		    fscanf(pid_file, "%d", &apmd_pid);
+		    fclose(pid_file);
+		}
+
+		kill(apmd_pid, SIGKILL);
+	    }
+	}
 	error = apm_suspend(fd);
 	break;
     case STANDBY: