NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

PR #46415; Setting of user-capacity.



Hi list

Michael van Elst <mlelstv%serpens.de@localhost> in his bug report writes that
"warning-under" is not supported.  My feeling is that it is not
_documented_, and perhaps it should not be.

After asking the list I was helped to find the right manuals. I have taken
the scripts in /etc/powerd.scripts as _examples_ which I could modify
to get what I wanted.  Partly by inserting new cases for the things i
wanted to monitor.

I too have encountered the event "warning-under".  The explanation I felt I
could see, had no effect on the logic I was after, so I simply report it
in /var(log/messages and on console and make an "exit 0" out of a new case.

But I have another problem with powerd and envsys.  I cannot set "user-capacity"

Man powerd(8) lines 126ff say that there is an event the battery sensor:
 >user-capacity       Capacity dropped below the limit set by the user. ..."
Also man envsys.conf(5) mentions the "user-capacity" in lines 73ff.

With power-sockets at hand, I would like my laptop to go into sleep mode, if the
capacity drops below a certain level.  Then my work is saved until I
find a power
socket.

Some basic information:

The system is NetBSD 5.1 AMD/64 GENERIC.

My battery is a SONY, Lion, AS09A41 0030.  The command "envstat -d acpibat0"
yelds:
                       Current  CritMax  CritMin  CritCap     Unit
[ 0]       present:         ON
[ 1]    design cap:      4.400                                  Ah
[ 2] last full cap:      3.940                                  Ah
[ 3]    technology:          1
[ 4]design voltage:     11.100                                   V
[ 5]      warn cap:      0.220                                  Ah  ( 5.58%)
[ 6]       low cap:      0.132                                  Ah  ( 3.35%)
[ 7]       voltage:     12.468                                   V
[ 8]   charge rate:        N/A
[ 9]discharge rate:        N/A
[10]        charge:      3.940                                  Ah  (100.00%)
[11]      charging:        OFF
[12]  charge state:     NORMAL

I have tried "envsys -c file" with the file-contents
 acpibat0 {
        sensorN { user-capacity = 12; }
 }
with N in the interval 0-12.  All of them give syntax error.

However, I can set
 acpibat0 {
        refresh-timeout = 10s ;
        sensor10 { critical-capacity = 12; }
 }
or:
  acpibat0 {
        refresh-timeout = 10s ;
        sensor10 { warning-capacity = 12 ; }
  }

both give an ugly script.  Whenever the event "normal" arrives
the script (after some tests) must send the computer into sleep.  Whereas
the events "critical-over" or "warning-over" will have to be ignored
(again after some testing).  The value of the {critical,warning}-capacity
is calculated in rc.local in order to alow 5 hours sleep-time before the
capacity drops below  [ 5] warn cap

Is it an error in the manuals or in envsys that I cannot set "user-capacity"?

Kind regards
  Hans Dinsen-Hansen


Home | Main Index | Thread Index | Old Index