Lenovo T530 - Battery Warnings
Joseph Mingrone
jrm at ftfl.ca
Sun Jul 7 06:00:13 UTC 2013
Ian Smith <smithi at nimnet.asn.au> writes:
> On Fri, 14 Jun 2013 10:58:11 -0300, Joseph Mingrone wrote:
>
> > I convinced a friend to try FreeBSD (9-STABLE amd64) on her Lenovo T530 and
> > things are running quite well. One problem is that, unlike other
> > IBM/Lenovos, there is no beep to warn her when the battery is about to die.
> > There is also no beep when (un)plugging the power. Beeping does work before
> > the OS is loaded (e.g. in the BIOS setup). The BIOS version is 2.04.
> >
> > Is there a fix for this?
>
> For AC<->battery changes, /etc/devd.conf already has devd perform:
>
> # Switch power profiles when the AC line state changes. notify 10 { match
> "system" "ACPI"; match "subsystem" "ACAD"; action "/etc/rc.d/power_profile
> $notify"; };
>
> You won't need to mess with power_profile but it's instructive and logs power
> changes to /var/log/messages.
>
> If you made that, say: action "/etc/rc.d/power_profile $notify &&
> /root/my_script $notify";
>
> then my_script can do whatever, with or without using parameter $notify
>
> if '# kldload speaker && spkrtest' makes useful noises on the speaker, then it's
> easy to make up a couple of satisfactory and noticeable alert 'tunes'. See
> speaker(4). I used these for years on an old Compaq with APM, which also could
> be configured to run alerts at every 10% battery level change, charging or
> discharging, enabling such as suspend on low battery where that wasn't built in,
> or other actions to save power.
>
> devd.conf(5) as well as /etc/devd.conf shows:
>
> ACPI Events related to the ACPI subsystem. Subsystem ACAD AC line state
> ($notify=0x00 is offline, 0x01 is online). Button Button state ($notify=0x00 is
> power, 0x01 is sleep). CMBAT Battery events. Lid Lid state ($notify=0x00 is
> closed, 0x01 is open). Thermal Thermal zone events.
>
> with an example also for thermal overheating pending shutdown, but I'm yet to
> find examples of any CMBAT battery events, regarding your first concern. That
> is, I've wondered about this myself ..
>
> Can anyone say, or point to, which ACPI CMBAT events get to devd?
>
After an upgrade to 9-STABLE, the speakers started working. I followed
you advice Ian to get the tones when switching between battery and AC.
I also tried to play a sound when the battery enters a LOW state, but
hw.acpi.battery.state remains in 1 (discharging) until the battery runs
out of power. A notification is triggered in devd when the battery hits
about 4%, but without a $notify I struggled to distinguish battery-related
events. The solution I came up with is a bit of a hack, but it works (for now).
I run a cronjob to check the remaining power and if it's at or below 5%
play a warning. Here is the script:
http://ftfl.ca:8080/admin/artifact/80e3121009ba836d1b6f57eda6207520b9807b63
Thanks again,
Joseph
More information about the freebsd-mobile
mailing list