hoelle wrote:
/usr/sbin/laptop_mode fails, when laptop has two battery slots and only
one is present.

Interesting. I've never actually seen such a situation, so I wasn't aware that a non-inserted battery would actually show up as an entry in /proc/acpi/battery/.

A start results in the following error messages:
Enabling laptop mode: remaining capacity:      1905 mAh
/usr/sbin/laptop_mode: line 612: [: : integer expression expected
/usr/sbin/laptop_mode: line 615: [: : integer expression expected
/usr/sbin/laptop_mode: line 618: [: : integer expression expected
/usr/sbin/laptop_mode: line 621: [: : integer expression expected

Looks like the variable $REMAINING is not set correctly in line 592 when
checking /proc/acpi/battery/BAT1/.

Hmmm, apparently an absent battery has no "remaining capacity" line, while it does have an "info" entry.

A fix might be checking /proc/acpi/battery/BATx/info before doing any
further operation.

Could you send me the contents of your /proc/acpi/battery/BAT1/info when the battery is present and when it is not present? Then I can add a check. The reason I'm asking is that I don't currently have a laptop available to check this on. :-/

On the other hand when multiple batteries are present
the value of REMAINING should contain the sum of all batteries when
determing other actions depending on that (?).

Well, it's possible, but:

* What if you have one battery that reports in MWH and another that reports in MAH? (Someone else submitted conversion logic earlier, but that requires that the battery correctly reports its current voltage, and I don't trust them to always do that properly.)

* Also, there might be voltage problems. During the last minutes the output voltage of a battery may drop significantly, and I expect that some devices may not like that (especially when there's suddenly a large power draw, e.g. when shutting down or hibernating).

( Batteries may lack some precision as well, so 2 times 2 minutes of charge (with error 1) is in the range 2-6 minutes, while 1 times 4 mintutes of charge with error 1 is in the range 3-5 minutes.

Those are all reasons why I am reluctant to regard two batteries with 2 minutes of charge as the same as one battery with 4 minutes of charge. Basically it boils down to "I don't trust them". :-)

--Bart


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to