diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-12-18 02:32:16 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-12-18 02:32:16 +0000 |
commit | 2abe1e6f4022109b1e179242aa9765810d7f680c (patch) | |
tree | 408f52f8bc6e4ae2a1c093439be5404fbbce56be /klaptopdaemon/acpi_helper.cpp | |
parent | 2bda8f7717adf28da4af0d34fb82f63d2868c31d (diff) | |
download | tdeutils-2abe1e6f4022109b1e179242aa9765810d7f680c.tar.gz tdeutils-2abe1e6f4022109b1e179242aa9765810d7f680c.zip |
* ark context un[tar/zip/bz] crash repair
* gcc4.4 compilation fixes
* superkaramba xmms sensor addition
* automake updates
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeutils@1063396 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'klaptopdaemon/acpi_helper.cpp')
-rw-r--r-- | klaptopdaemon/acpi_helper.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/klaptopdaemon/acpi_helper.cpp b/klaptopdaemon/acpi_helper.cpp index 660d2cb..cf5c980 100644 --- a/klaptopdaemon/acpi_helper.cpp +++ b/klaptopdaemon/acpi_helper.cpp @@ -100,7 +100,7 @@ void write_to_power(const char * str) Returns only if the program does not exist; if the program exists and is unsafe, exit; if the program exists and is safe, run it and never return. */ -void run_program(const char *path) +void run_program(const char *path, const int action) { struct stat sb; int err; @@ -118,7 +118,13 @@ void run_program(const char *path) exit(1); } ::setuid(::geteuid()); // otherwise bash will throw it away - ::execl(path, NULL); // this is not KDE environment code + if (action == 1) { + system("/usr/sbin/pmi action hibernate"); + } else if (action == 2) { + system("/usr/sbin/pmi action sleep"); + } else { + ::execl(path, NULL); // this is not KDE environment code + } exit(0); } @@ -139,11 +145,13 @@ main(int argc, char **argv) for (i = 1; i < argc; i++) if (strcmp(argv[i], "--suspend") == 0 || strcmp(argv[i], "-suspend") == 0) { /* Returns only if suspend does not exist. */ - run_program("/usr/sbin/suspend"); + run_program("/usr/sbin/pmi", 2); + /* if (useSysPower) write_to_power("mem"); else write_to_proc_sleep(3); + */ exit(0); } else if (strcmp(argv[i], "--standby") == 0 || strcmp(argv[i], "-standby") == 0) { @@ -158,15 +166,17 @@ main(int argc, char **argv) exit(0); } else if (strcmp(argv[i], "--hibernate") == 0 || strcmp(argv[i], "-hibernate") == 0) { - run_program("/usr/sbin/hibernate"); + run_program("/usr/sbin/pmi", 1); + /* if (useSysPower) write_to_power("disk"); else write_to_proc_sleep(4); + */ exit(0); } else if (strcmp(argv[i], "--software-suspend") == 0 || strcmp(argv[i], "-software-suspend") == 0) { - run_program("/usr/sbin/hibernate"); + run_program("/usr/sbin/hibernate", 0); exit(0); } else if (strcmp(argv[i], "--throttling") == 0 || strcmp(argv[i], "-throttling") == 0) { |