[Cpufreqd-devel] sources2/src cpufreqd_acpi_battery.c,1.23,1.24
Brought to you by:
mattia-san
From: Mattia D. <mat...@us...> - 2008-08-23 03:58:23
|
Update of /cvsroot/cpufreqd/sources2/src In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv20847/src Modified Files: cpufreqd_acpi_battery.c Log Message: From: Goedson Teixeira Paixao <go...@de...> BTS: http://bugs.debian.org/495655 Package: cpufreqd Version: 2.3.2-2 Severity: important cpufreqd fails to read battery info on my system because it tries to read files named "energy_full" and "energy_now" while the files are named "charge_full" and "charge_now". Index: cpufreqd_acpi_battery.c =================================================================== RCS file: /cvsroot/cpufreqd/sources2/src/cpufreqd_acpi_battery.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- cpufreqd_acpi_battery.c 9 Aug 2008 06:28:18 -0000 1.23 +++ cpufreqd_acpi_battery.c 23 Aug 2008 03:58:17 -0000 1.24 @@ -31,6 +31,8 @@ #define BATTERY_TYPE "Battery" #define ENERGY_FULL "energy_full" #define ENERGY_NOW "energy_now" +#define CHARGE_FULL "charge_full" +#define CHARGE_NOW "charge_now" #define PRESENT "present" #define STATUS "status" #define CURRENT_NOW "current_now" @@ -123,11 +125,20 @@ binfo->open = 1; binfo->energy_full = get_class_device_attribute(binfo->cdev, ENERGY_FULL); - if (!binfo->energy_full) - return -1; + if (!binfo->energy_full) { + /* try the "charge_full" name */ + binfo->energy_full = get_class_device_attribute(binfo->cdev, + CHARGE_FULL); + if (!binfo->energy_full) + return -1; + } binfo->energy_now = get_class_device_attribute(binfo->cdev, ENERGY_NOW); - if (!binfo->energy_now) - return -1; + if (!binfo->energy_now) { + /* try the "charge_now" name */ + binfo->energy_now = get_class_device_attribute(binfo->cdev, CHARGE_NOW); + if (!binfo->energy_now) + return -1; + } binfo->present = get_class_device_attribute(binfo->cdev, PRESENT); if (!binfo->present) return -1; @@ -306,8 +317,8 @@ continue; } - /* if battery not present skip to the next one */ - if (!info[i].is_present || info[i].capacity <= 0) { + /* if battery not open or not present skip to the next one */ + if (!info[i].open || !info[i].is_present || info[i].capacity <= 0) { continue; } clog(LOG_INFO, "%s - present\n", info[i].cdev->name); |