[PATCH] lib: fwts_battery: added interface for cycle count. acpi: battery: added cycle count check for acpi batteries.
Alex Hung
alex.hung at canonical.com
Tue May 15 14:04:33 UTC 2012
Hi Colin,
Thanks for spotting out the error. I will fix it.
Cheers,
Alex Hung
On 05/15/2012 08:06 PM, Colin Ian King wrote:
> On 15/05/12 10:40, Alex Hung wrote:
>> Signed-off-by: Alex Hung<alex.hung at canonical.com>
>> ---
>> src/acpi/battery/battery.c | 18 +++++++
>> src/lib/include/fwts_battery.h | 1 +
>> src/lib/src/fwts_battery.c | 111 ++++++++++++++++++++++++++++++++++++++++
>> 3 files changed, 130 insertions(+)
>>
>
> Since fwts_battery_get_cycle_count_sys_fs() and
> fwts_battery_get_cycle_count_proc_fs() can return without updating
> cycle_count we should probably initialise cycle_count before calling
> just in-case it is not updated, e.g.
>
> *cycle_count = 0;
>
>> +
>> + if ((dir = opendir(FWTS_SYS_CLASS_POWER_SUPPLY)) != NULL) {
>> + ret = fwts_battery_get_cycle_count_sys_fs(fw, dir, index, cycle_count);
>> + closedir(dir);
>> + } else if ((dir = opendir(FWTS_PROC_ACPI_BATTERY)) != NULL) {
>> + ret = fwts_battery_get_cycle_count_proc_fs(fw, dir, index,
>> cycle_count);
>> + closedir(dir);
>> + } else {
>> + return FWTS_ERROR;
>> + }
>> +
>> + return ret;
>> +}
>> +
>> int fwts_battery_get_name(fwts_framework *fw, int index, char *name)
>> {
>> int ret;
>
> Colin
>
More information about the fwts-devel
mailing list