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

Benjamin Herrenschmidt
2004-10-10T00:10:42Z

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.