Automatic shutdown with devd.

David DEMELIER demelier.david at
Tue Jun 1 08:55:10 UTC 2010


I recently asked to make an automatic shutdown when I excess a
specific percent. I ran devd with -Dd flags to run in background and
when the battery was at a critical state it said :

Processing event '!system=ACPI subsystem=CMBAT type=\_SB_.BAT0 notify=0x80'
Pushing table
setting system=ACPI
setting subsystem=CMBAT
setting type=\_SB_.BAT0
setting notify=0x80

Then I tried (for testing) something like this in my /etc/devd.conf

notify 10 {
        match "system"          "ACPI";
        match "subsystem"       "CMBAT";
        match "notify"          "0x80";
        action "logger LETGOSHUTDOWN";

And then I can see the following output in /var/log/messages :

Jun  1 10:48:54 Melon power_profile: changed to 'performance'
Jun  1 10:48:56 Melon root: LETGOSHUTDOWN
Jun  1 10:49:12 Melon root: LETGOSHUTDOWN
Jun  1 10:51:06 Melon last message repeated 2 times

It works, but the problem is that it makes this even the cable is
plugged ! i.e : the computer was not powered on so with 3% of
remaining time but AC plugged in after booting it (always with the AC
plugged in) these messages appears too. I guess the ACPI/CMBAT do not
care if there is an AC plugged in or not.

Is there a way to make this conditional to do only if the laptop is
not charging, AC plugged in ?

With king regards.

Demelier David

More information about the freebsd-questions mailing list