[ltp] T21 battery charging and draining problems

Kevin Locke linux-thinkpad@linux-thinkpad.org
Tue, 16 Aug 2005 16:56:37 -0600


--=-Ij175SFZPNMIM5sYD9t8
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Tue, 2005-08-16 at 01:09 -0700, Robert Kleemann wrote:
> The one problem I'm having is that although I'm getting an event when 
> the battery is added and removed, I'm not getting an event when ac power 
> is added or removed.  The acpi system is still aware of this as 
> /proc/acpi/ac_adapter/AC/state is updated accordingly but an event is 
> not sent to acpid.  I need these event to trigger a change to and from 
> the default runlevels to the battery runlevels.

Actually, the event that I get when adding or removing the AC adapter is
"battery BAT0 00000080 00000001".  The event for removing the battery is
"battery BAT0 00000081 00000000".  (for some reason I get duplicate
events when (un-)plugging the AC adapter; you may want to check that
your handler takes appropriate action for redundant events)

I am not sure if this is the expected/desired behavior, perhaps someone
with more experience with ThinkPad internals can chime in here... ;)
I just use a script to handle all battery events that checks the state
of the AC adapter and acts accordingly.

Hope it helps,
Kevin

P.S.  There are good example scripts on the ThinkWiki
(http://www.thinkwiki.org/wiki/Category:Scripts ), and distributed with
Laptop Mode Tools
(http://www.xs4all.nl/~bsamwel/laptop_mode/tools/index.html )

--=-Ij175SFZPNMIM5sYD9t8
Content-Disposition: attachment; filename=acpid.log
Content-Type: text/x-log; name=acpid.log; charset=UTF-8
Content-Transfer-Encoding: 7bit

=== Removing and reinserting AC adapter ===

[Tue Aug 16 16:13:54 2005] received event "battery BAT0 00000080 00000001"
[Tue Aug 16 16:13:54 2005] notifying client 4543[1000:1000]
[Tue Aug 16 16:13:54 2005] executing action "/etc/acpi/actions/battery.sh"
[Tue Aug 16 16:13:54 2005] BEGIN HANDLER MESSAGES
Setting HD spindown for battery mode.
Starting laptop_mode.
[Tue Aug 16 16:13:54 2005] END HANDLER MESSAGES
[Tue Aug 16 16:13:54 2005] action exited with status 0
[Tue Aug 16 16:13:54 2005] completed event "battery BAT0 00000080 00000001"
[Tue Aug 16 16:13:54 2005] received event "battery BAT0 00000080 00000001"
[Tue Aug 16 16:13:54 2005] notifying client 4543[1000:1000]
[Tue Aug 16 16:13:54 2005] executing action "/etc/acpi/actions/battery.sh"
[Tue Aug 16 16:13:54 2005] BEGIN HANDLER MESSAGES
Setting HD spindown for battery mode.
Laptop mode already active, not restarting.
[Tue Aug 16 16:13:54 2005] END HANDLER MESSAGES
[Tue Aug 16 16:13:54 2005] action exited with status 0
[Tue Aug 16 16:13:54 2005] completed event "battery BAT0 00000080 00000001"
[Tue Aug 16 16:14:41 2005] received event "battery BAT0 00000080 00000001"
[Tue Aug 16 16:14:41 2005] notifying client 4543[1000:1000]
[Tue Aug 16 16:14:41 2005] executing action "/etc/acpi/actions/battery.sh"
[Tue Aug 16 16:14:41 2005] BEGIN HANDLER MESSAGES
Setting HD spindown for AC mode.
Stopping laptop_mode.
[Tue Aug 16 16:14:43 2005] END HANDLER MESSAGES
[Tue Aug 16 16:14:43 2005] action exited with status 0
[Tue Aug 16 16:14:43 2005] completed event "battery BAT0 00000080 00000001"
[Tue Aug 16 16:14:43 2005] received event "battery BAT0 00000080 00000001"
[Tue Aug 16 16:14:43 2005] notifying client 4543[1000:1000]
[Tue Aug 16 16:14:43 2005] executing action "/etc/acpi/actions/battery.sh"
[Tue Aug 16 16:14:43 2005] BEGIN HANDLER MESSAGES
Setting HD spindown for AC mode.
Laptop mode was already disabled, not disabling.
[Tue Aug 16 16:14:43 2005] END HANDLER MESSAGES
[Tue Aug 16 16:14:43 2005] action exited with status 0
[Tue Aug 16 16:14:43 2005] completed event "battery BAT0 00000080 00000001"

=== Removing and reinserting battery ===

[Tue Aug 16 16:15:04 2005] received event "battery BAT0 00000081 00000000"
[Tue Aug 16 16:15:04 2005] notifying client 4543[1000:1000]
[Tue Aug 16 16:15:04 2005] executing action "/etc/acpi/actions/battery.sh"
[Tue Aug 16 16:15:04 2005] BEGIN HANDLER MESSAGES
Setting HD spindown for AC mode.
Laptop mode was already disabled, not disabling.
[Tue Aug 16 16:15:04 2005] END HANDLER MESSAGES
[Tue Aug 16 16:15:04 2005] action exited with status 0
[Tue Aug 16 16:15:04 2005] completed event "battery BAT0 00000081 00000000"
[Tue Aug 16 16:15:15 2005] received event "battery BAT0 00000081 00000001"
[Tue Aug 16 16:15:15 2005] notifying client 4543[1000:1000]
[Tue Aug 16 16:15:15 2005] executing action "/etc/acpi/actions/battery.sh"
[Tue Aug 16 16:15:15 2005] BEGIN HANDLER MESSAGES
Setting HD spindown for AC mode.
Laptop mode was already disabled, not disabling.
[Tue Aug 16 16:15:15 2005] END HANDLER MESSAGES
[Tue Aug 16 16:15:15 2005] action exited with status 0
[Tue Aug 16 16:15:15 2005] completed event "battery BAT0 00000081 00000001"
[Tue Aug 16 16:15:17 2005] received event "battery BAT0 00000080 00000001"
[Tue Aug 16 16:15:17 2005] notifying client 4543[1000:1000]
[Tue Aug 16 16:15:17 2005] executing action "/etc/acpi/actions/battery.sh"
[Tue Aug 16 16:15:17 2005] BEGIN HANDLER MESSAGES
Setting HD spindown for AC mode.
Laptop mode was already disabled, not disabling.
[Tue Aug 16 16:15:17 2005] END HANDLER MESSAGES
[Tue Aug 16 16:15:17 2005] action exited with status 0
[Tue Aug 16 16:15:17 2005] completed event "battery BAT0 00000080 00000001"

--=-Ij175SFZPNMIM5sYD9t8--