You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/app-laptop/laptop-mode-tools/files/1.62/0008-Re-order-the-check-bec...

51 lines
2.2 KiB

From fedcb181446734d5bf22e878fcde0d60e9edbcc8 Mon Sep 17 00:00:00 2001
From: Ritesh Raj Sarraf <rrs@debian.org>
Date: Sun, 10 Mar 2013 16:29:16 +0530
Subject: [PATCH 08/20] Re-order the check because HAL is deprecated
And for backward compatibility, still have the HAL check with the fix.
Thanks: Pacho Ramos
---
usr/sbin/laptop_mode | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/usr/sbin/laptop_mode b/usr/sbin/laptop_mode
index 35b3b08..6ef1e41 100755
--- a/usr/sbin/laptop_mode
+++ b/usr/sbin/laptop_mode
@@ -670,20 +670,20 @@ lmt_main_function ()
fi
if [ "$ENABLE_LAPTOP_MODE_WHEN_LID_CLOSED" -ne 0 -a "$ACTIVATE" -eq 0 ] ; then
- if [ -x "`which hal-find-by-property`" ] ; then
- HAL_LID_BUTTON=$(hal-find-by-property --key "button.type" --string "lid")
- fi
- if [ "$HAL_LID_BUTTON" != "" ] ; then
- HAL_LID_BUTTON_STATE=$(hal-get-property --udi $(hal-find-by-property --key "button.type" --string "lid") --key "button.state.value")
- if [ "$HAL_LID_BUTTON_STATE" = "true" ] ; then
- log "VERBOSE" "Setting action to \"start\" because the lid is closed (says HAL)."
- ACTIVATE=1
- fi
- elif [ -f /proc/acpi/button/lid/*/state ] ; then
+ if [ -f /proc/acpi/button/lid/*/state ] ; then
if ( grep -q "closed" /proc/acpi/button/lid/*/state ) ; then
log "VERBOSE" 'Setting action to "start" because the lid is closed (says /proc/acpi/button/lid/*/state).'
ACTIVATE=1
fi
+ elif ( which hal-find-by-property >/dev/null ) ; then
+ HAL_LID_BUTTON=$($HAL_FIND_BY_PROPERTY --key "button.type" --string "lid")
+ if [ "$HAL_LID_BUTTON" != "" ] ; then
+ HAL_LID_BUTTON_STATE=$(hal-get-property --udi $(hal-find-by-property --key "button.type" --string "lid") --key "button.state.value")
+ if [ "$HAL_LID_BUTTON_STATE" = "true" ] ; then
+ log "VERBOSE" "Setting action to \"start\" because the lid is closed (says HAL)."
+ ACTIVATE=1
+ fi
+ fi
else
log "MSG" "Warning: ENABLE_LAPTOP_MODE_WHEN_LID_CLOSED is set, but there is no file"
log "MSG" "/proc/acpi/button/lid/.../state, and hal information is not available either!"
--
1.8.1.5