Rewrite of sharp 2.4 kernels APM workaround to C. Shell version: --------------------------------------------------------------- #!/bin/sh if ( cat /proc/cpuinfo|grep -i hardware|grep -i SHARP ) && \ [ ".$@" = ".-s" -o ".$@" = ".--suspend" ]; then killall -USR1 apmd || /usr/bin/apm.orig -s else /usr/bin/apm.orig "$@" fi --------------------------------------------------------------- C version: --------------------------------------------------------------- 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 15:15:36.000000000 +0100 @@ -28,6 +28,7 @@ #include #include #include +#include #include "apm.h" static int verbose = 0; @@ -43,6 +44,8 @@ int fd; time_t then, now; int error; + FILE* pid_file; + int apmd_pid; fd = open(APM_DEVICE, O_WRONLY); if (fd < 0) @@ -54,6 +57,17 @@ switch (mode) { case SUSPEND: + if( 0 == system("grep -i hardware /proc/cpuinfo|grep -i SHARP")) + { + 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: