bojo42 wrote:
> @angel chen: good question. i'm somewhat confused by that, but when
> laptop mode is disabled in general in /etc/default/acpi-support then
> logically it shouldn't be enabled by default on battery either. but you
> could you tell me how you started laptop mode when "cat
> /proc/sys/vm/laptop_mode" still gives you a zero.
>
> @all: who knows for sure if laptop mode is enabled on battery in
> intrepid?
>
> who knows how to reliable check if laptop mode is enabled, for fixing
> the included scripts in intrepid?
Checking for /proc/sys/vm/laptop_mode is not the way to go. This is to
check if the _kernel feature_ called "laptop mode" is enabled. What you
need to check for is whether the relevant functionality of the _package_
laptop-mode-tools is enabled, a very different thing (yes, the name
"laptop-mode-tools" is a confusing name -- blame history!). Because if
it is, then laptop-mode-tools will handle this stuff regardless of
battery, non-battery, and the state of the kernel feature that is
represented by /proc/sys/vm/laptop_mode. (The /proc/sys/vm/laptop_mode
feature is also controlled by laptop-mode-tools, but this is independent
of the hdparm features and should absolutely be ignored!) How to check
if (a) the _package_ laptop-mode-tools is enabled AND (b) its feature
controlling hdparm is enabled? Well:
(a): by checking /etc/default/acpi-support for ENABLE_LAPTOP_MODE=true
(b): by executing /etc/laptop-mode/laptop-mode.conf and testing whether
CONTROL_HD_POWERMGMT=1
The current 90-hdparm.sh already does (b). One should simply add (a).
One could replace this:
if [ -e /usr/sbin/laptop_mode ] ; then
LMT_CONTROL_HD_POWERMGMT=$(. /etc/laptop-mode/laptop-mode.conf && echo
"$CONTROL_HD_POWERMGMT")
if [ "$LMT_CONTROL_HD_POWERMGMT" != 0 ] ; then
# Laptop mode controls hdparm -B settings, we don't.
DO_HDPARM=n
fi
fi
by:
if [ -e /usr/sbin/laptop_mode ] ; then
LMT_CONTROL_HD_POWERMGMT=$(. /etc/laptop-mode/laptop-mode.conf && echo
"$CONTROL_HD_POWERMGMT")
ACPI_SUPPORT_ENABLE_LAPTOP_MODE=$(. /etc/default/acpi-support && echo
"$ENABLE_LAPTOP_MODE")
if [ "$LMT_CONTROL_HD_POWERMGMT" != 0 &&
"$ACPI_SUPPORT_ENABLE_LAPTOP_MODE" = "true" ] ; then
# Laptop mode controls hdparm -B settings, we don't.
DO_HDPARM=n
fi
fi
bojo42 wrote: acpi-support then vm/laptop_ mode" still gives you a zero.
> @angel chen: good question. i'm somewhat confused by that, but when
> laptop mode is disabled in general in /etc/default/
> logically it shouldn't be enabled by default on battery either. but you
> could you tell me how you started laptop mode when "cat
> /proc/sys/
>
> @all: who knows for sure if laptop mode is enabled on battery in
> intrepid?
>
> who knows how to reliable check if laptop mode is enabled, for fixing
> the included scripts in intrepid?
Checking for /proc/sys/ vm/laptop_ mode is not the way to go. This is to vm/laptop_ mode. (The /proc/sys/ vm/laptop_ mode
check if the _kernel feature_ called "laptop mode" is enabled. What you
need to check for is whether the relevant functionality of the _package_
laptop-mode-tools is enabled, a very different thing (yes, the name
"laptop-mode-tools" is a confusing name -- blame history!). Because if
it is, then laptop-mode-tools will handle this stuff regardless of
battery, non-battery, and the state of the kernel feature that is
represented by /proc/sys/
feature is also controlled by laptop-mode-tools, but this is independent
of the hdparm features and should absolutely be ignored!) How to check
if (a) the _package_ laptop-mode-tools is enabled AND (b) its feature
controlling hdparm is enabled? Well:
(a): by checking /etc/default/ acpi-support for ENABLE_ LAPTOP_ MODE=true mode/laptop- mode.conf and testing whether HD_POWERMGMT= 1
(b): by executing /etc/laptop-
CONTROL_
The current 90-hdparm.sh already does (b). One should simply add (a).
One could replace this:
if [ -e /usr/sbin/ laptop_ mode ] ; then HD_POWERMGMT= $(. /etc/laptop- mode/laptop- mode.conf && echo HD_POWERMGMT" ) HD_POWERMGMT" != 0 ] ; then
LMT_CONTROL_
"$CONTROL_
if [ "$LMT_CONTROL_
# Laptop mode controls hdparm -B settings, we don't.
DO_HDPARM=n
fi
fi
by:
if [ -e /usr/sbin/ laptop_ mode ] ; then HD_POWERMGMT= $(. /etc/laptop- mode/laptop- mode.conf && echo HD_POWERMGMT" ) SUPPORT_ ENABLE_ LAPTOP_ MODE=$( . /etc/default/ acpi-support && echo LAPTOP_ MODE") HD_POWERMGMT" != 0 && SUPPORT_ ENABLE_ LAPTOP_ MODE" = "true" ] ; then
LMT_CONTROL_
"$CONTROL_
ACPI_
"$ENABLE_
if [ "$LMT_CONTROL_
"$ACPI_
# Laptop mode controls hdparm -B settings, we don't.
DO_HDPARM=n
fi
fi
and that should do the trick.
Cheers,
Bart