Bug#351351: laptop-mode-tools: laptop-mode init fails when second battery not present

2006-02-04 Thread hoelle
Package: laptop-mode-tools
Version: 1.22-1
Severity: normal

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

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/.

A fix might be checking /proc/acpi/battery/BATx/info before doing any
further operation. 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 (?).

Best regards,
Frank



-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)

laptop-mode-tools depends on no packages.

Versions of packages laptop-mode-tools recommends:
ii  acpid 1.0.4-5Utilities for using ACPI
power man
ii  hdparm6.3-3  tune hard disk parameters
for high
pn  sdparmnone (no description available)

-- no debconf information


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



Bug#351351: laptop-mode-tools: laptop-mode init fails when second battery not present

2006-02-04 Thread Bart Samwel

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]