From owner-freebsd-mobile@FreeBSD.ORG Sun Jul 7 06:00:13 2013 Return-Path: Delivered-To: freebsd-mobile@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7258B176 for ; Sun, 7 Jul 2013 06:00:13 +0000 (UTC) (envelope-from freebsd-mobile@m.gmane.org) Received: from plane.gmane.org (plane.gmane.org [80.91.229.3]) by mx1.freebsd.org (Postfix) with ESMTP id 34B691229 for ; Sun, 7 Jul 2013 06:00:12 +0000 (UTC) Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Uvi14-0001Be-0I for freebsd-mobile@freebsd.org; Sun, 07 Jul 2013 08:00:10 +0200 Received: from dynamic34-29.dynamic.dal.ca ([129.173.34.203]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 07 Jul 2013 08:00:10 +0200 Received: from jrm by dynamic34-29.dynamic.dal.ca with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 07 Jul 2013 08:00:10 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-mobile@freebsd.org From: Joseph Mingrone Subject: Re: Lenovo T530 - Battery Warnings Date: Sun, 07 Jul 2013 02:59:56 -0300 Lines: 62 Message-ID: <8638rq7vvn.fsf@gly.ath.cx> References: <86sj0krdzg.fsf@gly.ath.cx> <20130615230808.N59753@sola.nimnet.asn.au> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: dynamic34-29.dynamic.dal.ca User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) Cancel-Lock: sha1:8i16lHG2K2MyIjmjF+NLMU0IM9Y= X-BeenThere: freebsd-mobile@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Mobile computing with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2013 06:00:13 -0000 Ian Smith 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