aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArjan van der Ven <arjan@linux.intel.com>2008-03-27 04:01:21 +0000
committerArjan van der Ven <arjan@linux.intel.com>2008-03-27 04:01:21 +0000
commiteeb2e1703d04511db134a144178be02a1dc2fc8c (patch)
tree681b3a73e8caf3593663d34756468fc965cf0ed3
parenta90b352c058b42c0868f61431b28a6c309c7ba7f (diff)
downloadandroid_external_powertop-eeb2e1703d04511db134a144178be02a1dc2fc8c.tar.gz
android_external_powertop-eeb2e1703d04511db134a144178be02a1dc2fc8c.tar.bz2
android_external_powertop-eeb2e1703d04511db134a144178be02a1dc2fc8c.zip
Fix USB suspend suggestion
git-svn-id: https://powertop.googlecode.com/svn/trunk@278 0bbd23ad-e62f-0410-b3b3-4ddab988b7fa
-rw-r--r--Changelog2
-rw-r--r--powertop.c3
-rw-r--r--usb.c23
3 files changed, 27 insertions, 1 deletions
diff --git a/Changelog b/Changelog
index 0a90581..0f1be90 100644
--- a/Changelog
+++ b/Changelog
@@ -6,6 +6,8 @@
* Show USB suspend statistics of USB devices in "-d" dump mode
* Add support for using the sysfs power supply class
(Donnie Berkholz)
+ * Fix USB suspend suggestion to take semi blacklisted stuff into
+ account
1.9 --
* add support for mac80211 based wireless power saving
diff --git a/powertop.c b/powertop.c
index 6b8c609..dd12f74 100644
--- a/powertop.c
+++ b/powertop.c
@@ -371,7 +371,7 @@ static void read_data_cpuidle(uint64_t * usage, uint64_t * duration)
if (f) {
clevel = 0;
- sprintf(cnames[clevel], "polling");
+ sprintf(cnames[clevel], _("polling"));
}
sprintf(filename + len, "/%s/usage", entry->d_name);
@@ -726,6 +726,7 @@ int main(int argc, char **argv)
do_proc_irq();
do_cpufreq_stats();
count_usb_urbs();
+ count_usb_urbs();
memset(cur_usage, 0, sizeof(cur_usage));
memset(cur_duration, 0, sizeof(cur_duration));
diff --git a/usb.c b/usb.c
index 3d1f7bb..da4bee3 100644
--- a/usb.c
+++ b/usb.c
@@ -52,6 +52,12 @@ static void activate_usb_autosuspend(void)
continue;
fprintf(file, "0\n");
fclose(file);
+ sprintf(filename, "/sys/bus/usb/devices/%s/power/level", dirent->d_name);
+ file = fopen(filename, "w");
+ if (!file)
+ continue;
+ fprintf(file, "auto\n");
+ fclose(file);
}
closedir(dir);
@@ -87,6 +93,23 @@ void suggest_usb_autosuspend(void)
need_hint = 1;
fclose(file);
+
+
+ sprintf(filename, "/sys/bus/usb/devices/%s/power/level", dirent->d_name);
+ file = fopen(filename, "r");
+ if (!file)
+ continue;
+ memset(line, 0, 1024);
+ if (fgets(line, 1023,file)==NULL) {
+ fclose(file);
+ continue;
+ }
+ if (strstr(line, "on"))
+ need_hint = 1;
+
+ fclose(file);
+
+
}
closedir(dir);