[Pm-utils] [PATCH 1/3] Automagically grab quirks from HAL
Victor Lowther
victor.lowther at gmail.com
Wed Sep 10 04:40:39 PDT 2008
Add functionality to grab quirks from HAL if we were not invoked by HAL.
To use this functionality, run pm(suspend|hibernate|suspend-hybrid) with
--auto-quirks.
---
pm/sleep.d/00auto-quirk | 26 ++++++++++++++++++++++++++
pm/sleep.d/Makefile.am | 1 +
2 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/pm/sleep.d/00auto-quirk b/pm/sleep.d/00auto-quirk
new file mode 100755
index 0000000..3514869
--- /dev/null
+++ b/pm/sleep.d/00auto-quirk
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+. "${PM_FUNCTIONS}"
+
+do_add_quirks()
+{
+ add_parameters $(lshal | \
+ awk -F '[. ]' \
+ '/ power_management.quirk.[a-z_]+ = true/ \
+ {gsub(/_/, "-", $5); printf("--quirk-%s", $5)}')
+}
+
+mabye_add_quirks()
+{
+ for p in ${PM_CMDLINE}; do
+ [ "$p" = "--auto-quirks" ] || continue
+ do_add_quirks
+ remove_parameters --auto-quirks
+ done
+}
+
+case $1 in
+ suspend|hibernate) mabye_add_quirks ;;
+ *) exit $NA
+esac
+
diff --git a/pm/sleep.d/Makefile.am b/pm/sleep.d/Makefile.am
index a2f31cc..2972d20 100644
--- a/pm/sleep.d/Makefile.am
+++ b/pm/sleep.d/Makefile.am
@@ -1,6 +1,7 @@
sleepdir = $(libdir)/pm-utils/sleep.d
sleep_SCRIPTS = \
+ 00auto-quirk \
00logging \
00powersave \
01grub \
--
1.5.6.5
More information about the Pm-utils
mailing list