Re: [PATCH]: pbook apm_emu.c fix remaining time when charging

From: Benjamin Herrenschmidt
Date: Sat Oct 09 2004 - 19:12:25 EST


On Sun, 2004-10-10 at 06:11, Soeren Sonnenburg wrote:
> Hi,
>
> this should make /proc/apm
>
> a) display the remaining time until the battery is fully charged and
> b) when the system is on AC but the battery is not getting charged 0 is
> displayed as remaining time.
>
> Please comment/apply,
> Soeren

if (amperage < 0) {
+ /* when less than 100mA are used the machine must be on AC and as it is
+ not charging the battery is only slightly self decharging and thus full be definition */
+ if (amperage < 100) {

There must be something wrong in the above...

+ time_units = (charge * 59) / (amperage * -1);
+ else
+ time_units = (charge * 16440) / (amperage * -60);

Can you make sure also that amperage is never 0 ?

Ben.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/