From 7e0669993909e51fa8c3ad0d1d613083a3c5122d Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 25 Nov 2009 12:31:34 +0100 Subject: [PATCH 3/3] on_ac_power: DeviceKit-power support Try to contact DeviceKit-Power in on_ac_power, and if it succeeds, use that. Otherwise fall back to hal. https://bugs.freedesktop.org/show_bug.cgi?id=25274 --- src/on_ac_power | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/src/on_ac_power b/src/on_ac_power index edddf72..3a77734 100755 --- a/src/on_ac_power +++ b/src/on_ac_power @@ -30,6 +30,15 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# prefer DeviceKit-power if available +if s=`dbus-send --system --print-reply --dest=org.freedesktop.DeviceKit.Power /org/freedesktop/DeviceKit/Power org.freedesktop.DBus.Properties.Get string:org.freedesktop.DeviceKit.Power string:OnBattery`; then + if echo "$s" | grep -q 'boolean false'; then + exit 0 + else + exit 1 + fi +fi + # Check for AC/DC/etc adapters ac_adapters="$(hal-find-by-capability --capability ac_adapter)" -- 1.6.5