[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: LEDs, gnome-power-manager, and ThinkPads



Bill Wohler <wohler@newt.com> writes:

> Bill Wohler <wohler@olgas.newt.com> wrote:
>
>> I'd like to turn the light to the CD-ROM off when I suspend and then
>> back on when I resume. This can be done by calling "echo 4 on >|
>> /proc/acpi/ibm/led" and "echo 4 off >| /proc/acpi/ibm/led". Can these
>> commands be run by gnome-power-manager when suspending and waking up?
>
> I discovered /usr/lib/hal/scripts/linux/hal-system-power-suspend-linux.
> I can either hack that directly (yuck); however, I see I can also
> resurrect my old /etc/acpi/sleep.sh script.
>
> But the way it's set up, if I provide /etc/acpi/sleep.sh, I also have to
> know how my system is suspended, which isn't user-friendly. I think it
> would be nice to provide pre- and post-suspend hooks instead. Thoughts?

Thanks to an unrelated tip from Stefan Monnier, I installed the
hibernate package, and created a file called
/etc/hibernate/scriptlets.d/local which contains the following. If you
want to use it, replace my initials (BW) with your own since the
hibernate namespace is global.

----- clip -----
# -*- sh -*-
# vim:ft=sh:ts=8:sw=4:noet

# Ideas from /usr/share/hibernate/scriptlets.d/hardware_tweaks.

# ibm_acpi proc directory
BW_IBM_ACPI_PROC=/proc/acpi/ibm

BwIbmAcpiStartSuspend() {
    # Turn off Ultrabay LED.
    IbmAcpiLed 4 off
    return 0 # this shouldn't stop suspending
}

BwIbmAcpiEndResume() {
    # Turn on Ultrabay LED.
    IbmAcpiLed 4 on
    return 0
}

BwIbmAcpiOptions() {
    if [ -d "$BW_IBM_ACPI_PROC" -a -z "$BW_IBM_ACPI_HOOKED" ]; then
        AddSuspendHook 12 BwIbmAcpiStartSuspend
        AddResumeHook 12 BwIbmAcpiEndResume
        BW_IBM_ACPI_HOOKED=1
    fi

    return 0
}

BwIbmAcpiOptions
----- clip -----
 
-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD



Reply to: