OESF Portables Forum
General Forums => General Discussion => Topic started by: lardman on September 23, 2004, 10:27:57 am
-
This is not really important, but I'd sometimes like to know what the current battery status is while charging is underway (and I'd also like the battery charging animation on the task bar to reflect this) without having to pull the power lead out and wait for the apm output to change.
Looking at the taskbar icon on OZ 3.5.1, I notice that when you plug the power in, it indicates that it's charging by running through a little animation (not sure how many steps) which makes it appear that the battery is being charged from 0% (so the animation starts at 0% and works its way up to 100% then starts again, etc.).
On my Sony-Ericsson T610 the charging icon starts the animation at the current battery level and then animates up to 100%; as the battery is charged the start point moves up.
Now I'm pretty sure this used to be done for OZ, but no longer.
I was just wondering whether this is due to the apm output changing (?), or a change in the battery icon code.
So, could someone post the output of 'cat /proc/apm' with external power applied, please (I don't have a charger with me)?
Also, if anyone with a different ROM actually gets the behaviour I'm wanting could they post too and let me know
My 'cat /proc/apm', with no external power, is showing:
1.14 1.2 0x02 0x00 0x00 0x01 98% -1 ?
Si
-
I wrote my own perl script to track battery usage - as an exercise in programming rather than in utility - and came across a similar problem.
In my case, I was calling /usr/local/bin/apm rather than grokking /proc/apm, and it only ever reports "charging" (with no status). I presumed the battery meter was doing the same.
Here's the contents of my /proc/apm from just now:
Without charging:
1.14 1.2 0x02 0x00 0x00 0x01 50% -1 ?
Immediately after plugging in power:
1.14 1.2 0x02 0x01 0x03 0x08 255% -1 ?
The file <srcdir>/arch/arm/kernel/apm.c gives the field definitions in /proc/apm as:
/*
* Arguments, with symbols from linux/apm_bios.h.
*
* 0) Linux driver version (this will change if format changes)
* 1) APM BIOS Version. Usually 1.0, 1.1 or 1.2.
* 2) APM flags from APM Installation Check (0x00):
* bit 0: APM_16_BIT_SUPPORT
* bit 1: APM_32_BIT_SUPPORT
* bit 2: APM_IDLE_SLOWS_CLOCK
* bit 3: APM_BIOS_DISABLED
* bit 4: APM_BIOS_DISENGAGED
* 3) AC line status
* 0x00: Off-line
* 0x01: On-line
* 0x02: On backup power (BIOS >= 1.1 only)
* 0xff: Unknown
* 4) Battery status
* 0x00: High
* 0x01: Low
* 0x02: Critical
* 0x03: Charging
* 0x04: Selected battery not present (BIOS >= 1.2 only)
* 0xff: Unknown
* 5) Battery flag
* bit 0: High
* bit 1: Low
* bit 2: Critical
* bit 3: Charging
* bit 7: No system battery
* 0xff: Unknown
* 6) Remaining battery life (percentage of charge):
* 0-100: valid
* -1: Unknown
* 7) Remaining battery life (time units):
* Number of remaining minutes or seconds
* -1: Unknown
* 8) min = minutes; sec = seconds
*/
..Which, from the above, I interpret to mean the unit's using Linux APM 1.14, APM Spec 1.2, it's got 32 Bit APM support (no other flags), my power is external, the battery WAS "low" and is now "charging", and (critically) 255 looks like -1 to me - battery life percentage unknown.
I think you're out of luck...
-
Here's on external power with full charge:
1.14 1.2 0x02 0x01 0x00 0x01 100% -1 ?
Greg
-
Cheers guys.
Shame it's not going to be as easy as I'd wanted. I could cheat and have the applet remember the last battery state before it started charging - which would possibly be better than the current method, but ideally one would want the battery status all the time.
Is it the battery which decides whether to charge? I wonder if it'd be possible to alter the kernel apm code to return the battery level during charging (assuming the battery is able to report it).
I'll take a look at it.
Si