Hello Eugen,

sorry for the long delay. This problem was not in the top 10 of my urgent
problems, but between christmas and new year, it raised up again and I
found a solution. Now, I it was active awhile and I'm contented with it.

Eugen Dedu schrieb am Wed 20. Sep, 20:03 (+0200):
> If I understand correctly, you wish to have a value, for ex. 20, which gives 
> the number of minutes that the computer can still be on after the battery 
> level 
> reaches 0.

Yes. I think it's important that the time goes down to zero.

I observed the maximum charge level some weeks and I can say, it's
important that the level reaches the zero limit. The firmware of the
battery recalculates the maximum charge level upon reaching zero. Due
to this the last minute can be very long and it's a waste to shut down
the computer at 2 minutes, because than the firmware reduces the maximum
charge level continuously. It will never detect that the expected value
is too low, because the voltage does not fall below a specified level.

This is IMO what happens in the last minute. The firmware waits until a
special condition is reached and then it sets the maximum charge level.

My solution is to set EmergencyAction = command and use the following in
/etc/power/pmcs-pbbuttonsd

case "$1" in
  emergency)
    ( while [ "$(sed -n '/time rem/{s/.*: //;p;}' /proc/pmu/battery_0)" -gt 0 ] 
&&
        [ "$(sed -n '/AC Power/{s/.*: //;p;}' /proc/pmu/info)" -eq 0 ] &&
        sleep 60; do :; done
      if grep -q 'eth0=home' /etc/network/run/ifstate; then
          while [ "$(sed -n '/voltage/{s/.*: //;p;}' /proc/pmu/battery_0)" -gt 
9500 ] &&
            [ "$(sed -n '/AC Power/{s/.*: //;p;}' /proc/pmu/info)" -eq 0 ] &&
            sleep 60; do :; done
      fi
      if [ "$(sed -n '/AC Power/{s/.*: //;p;}' /proc/pmu/info)" -eq 0 ]; then
          pbbcmd -i sleep
          # shutdown -h now "Low battery - system will go down now!"
      fi
    ) &
    ;;
esac

Ths first if‐then is to detect if I'm at home. Then the voltage level can
go down to 9,5V, because I can everytime plug in the power connector.
Otherwise I need the whole reserve to let the iBook sleep until I can
plug in the power connector.

Bye, Jörg.
-- 
“…anytime you install something new on the Windows platform, you risk
spending the next five or six hours trying to figure out what happened”
            (Robert Roblin, Adobe)

Attachment: pgpR0vHEPXqpA.pgp
Description: PGP signature

Reply via email to