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".

The attached patch fixes this by trying the charge_* names of reading energy_*
fails.


-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-1-686 (SMP w/1 CPU core)
Locale: LANG=pt_BR.UTF-8, LC_CTYPE=pt_BR.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to pt_BR.UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages cpufreqd depends on:
ii  libc6                         2.7-13     GNU C Library: Shared libraries
ii  libcpufreq0                   004-2      shared library to deal with the cp
ii  libsensors3                   1:2.10.7-1 library to read temperature/voltag
ii  libsysfs2                     2.1.0-4    interface library to sysfs
ii  lsb-base                      3.2-19     Linux Standard Base 3.2 init scrip

Versions of packages cpufreqd recommends:
ii  acpid                         1.0.6-10   Utilities for using ACPI power man

Versions of packages cpufreqd suggests:
ii  cpufrequtils                  004-2      utilities to deal with the cpufreq

-- no debconf information
--- cpufreqd-2.3.2.orig/src/cpufreqd_acpi_battery.c
+++ cpufreqd-2.3.2/src/cpufreqd_acpi_battery.c
@@ -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;

Reply via email to