tags 644567 +patch thanks Reformatted the patch so it is no longer invalid and enriched it with metadata, see attachment
I also tested the patch and it seems to do the Right Thing™. -- Roland
From: Roland Hieber <roh...@rohieb.name> Subject: Use power_now instead of current_now to read power from sysfs Apparently, current_now was renamed to power_now around kernel 2.6.36. The fix in this patch first tries to read from the new file name, if this does not exist, it tries the old name. Bug: 644567 Author: niko2gare <http://sourceforge.net/users/niko2gare/> Origin: http://sourceforge.net/tracker/?func=detail&aid=3172707&group_id=58904&atid=489239 Last-Update: 2012-10-12 Index: cpufreqd-2.4.2/src/cpufreqd_acpi_battery.c =================================================================== --- cpufreqd-2.4.2.orig/src/cpufreqd_acpi_battery.c 2010-04-18 15:57:41.000000000 +0200 +++ cpufreqd-2.4.2/src/cpufreqd_acpi_battery.c 2012-10-12 03:45:33.000000000 +0200 @@ -36,6 +36,7 @@ #define PRESENT "present" #define STATUS "status" #define CURRENT_NOW "current_now" +#define POWER_NOW "power_now" struct battery_info { int capacity; @@ -145,9 +146,13 @@ binfo->status = get_class_device_attribute(binfo->cdev, STATUS); if (!binfo->status) return -1; - binfo->current_now = get_class_device_attribute(binfo->cdev, CURRENT_NOW); - if (!binfo->current_now) - return -1; + binfo->current_now = get_class_device_attribute(binfo->cdev, POWER_NOW); + if (!binfo->current_now) { + /* try the "current_now" name as a fallback */ + binfo->current_now = get_class_device_attribute(binfo->cdev, CURRENT_NOW); + if (!binfo->current_now) + return -1; + } /* read the last full capacity, this is not going to change * very often, so no need to poke it later */