Date: Sat, 25 Nov 2006 12:40:15 -0800 From: Nate Lawson <nate@root.org> To: "M. Warner Losh" <imp@bsdimp.com> Cc: freebsd-acpi@freebsd.org Subject: Re: How do I... Message-ID: <4568AA2F.4050602@root.org> In-Reply-To: <20061124.201214.1656128345.imp@bsdimp.com> References: <20061124.201214.1656128345.imp@bsdimp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
M. Warner Losh wrote: > ... run a command when there's < 1% battery life left? > > Warner You add support here in acpi_cmbat.c: /* XXX If all batteries are critical, perhaps we should suspend. */ if (sc->bst.state & ACPI_BATT_STAT_CRITICAL) { if ((sc->flags & ACPI_BATT_STAT_CRITICAL) == 0) { sc->flags |= ACPI_BATT_STAT_CRITICAL; device_printf(dev, "critically low charge!\n"); } } Use the acpi_NotifyMumble function to send a value to devd. You probably want to make sure you're off AC power also since you may still have that crit state when plugged in. So read the value of AC status (see kern_power.c for how to do this) before sending the notify. -- Nate
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4568AA2F.4050602>