diff options
author | Arjan van der Ven <arjan@linux.intel.com> | 2008-03-27 04:01:21 +0000 |
---|---|---|
committer | Arjan van der Ven <arjan@linux.intel.com> | 2008-03-27 04:01:21 +0000 |
commit | eeb2e1703d04511db134a144178be02a1dc2fc8c (patch) | |
tree | 681b3a73e8caf3593663d34756468fc965cf0ed3 | |
parent | a90b352c058b42c0868f61431b28a6c309c7ba7f (diff) | |
download | android_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-- | Changelog | 2 | ||||
-rw-r--r-- | powertop.c | 3 | ||||
-rw-r--r-- | usb.c | 23 |
3 files changed, 27 insertions, 1 deletions
@@ -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 @@ -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)); @@ -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); |