Kok, Auke wrote:

> 
> All,
> 
> I'm planning on doing a quick powertop release within the next 2 weeks, since
> I've gotten a reasonable number of updates recently. If you have submitted a
> patch or translation before, or if you just have the time to do a quick
> checkout and test, please take the time now to give the current SVN trunk a
> run. [1]

Attached is a patch that doesn't pointlessly suggest enabling USB autosuspend
when it is already enabled, but some device keeps being active 100% of the
time.

-- 

  Felipe Sateler
Index: urbnum.c
===================================================================
--- urbnum.c	(revision 307)
+++ urbnum.c	(working copy)
@@ -40,6 +40,7 @@
 	char pathname[4096];
 	char human_name[4096];
 	uint64_t urbs, active, connected;
+	long autosuspend;
 	uint64_t previous_urbs, previous_active, previous_connected;
 	int controller;
 };
@@ -84,6 +85,13 @@
 			fgets(name, 4096, file);
 			ptr->connected = strtoull(name, NULL, 10);
 			fclose(file);
+			sprintf(fullpath, "%s/power/autosuspend", path);
+			file = fopen(fullpath, "r");
+			if (!file)
+				return;
+			fgets(name, 4096, file);
+			ptr->autosuspend = strtol(name, NULL, 10);
+			fclose(file);
 
 			return;
 		}
@@ -201,7 +209,8 @@
 	total_active = 0;
 	dev = devices;
 	while (dev) {
-		if (dev->active-1 > dev->previous_active && !dev->controller) {
+		if (dev->active-1 > dev->previous_active
+				&& !dev->controller && dev->autosuspend < 0) {
 			if (total_active == pick) {
 				char usb_hint[8000];
 				sprintf(usb_hint, _("A USB device is active %4.1f%% of the time:\n%s"),

_______________________________________________
Power mailing list
[email protected]
http://www.bughost.org/mailman/listinfo/power

Reply via email to