public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] USB: Only enable autosuspend by default on certain device classes
@ 2007-08-02 23:56 Matthew Garrett
  2007-08-03  1:15 ` Greg KH
  0 siblings, 1 reply; 56+ messages in thread
From: Matthew Garrett @ 2007-08-02 23:56 UTC (permalink / raw)
  To: linux-usb-devel; +Cc: gregkh, amitk, linux-kernel

We're seeing a large number of problems with devices not appreciating 
USB autosuspend, especially printers and scanners. According to 
http://www.microsoft.com/whdc/system/bus/USB/USBFAQ_intro.mspx only a 
subset of drivers support it in Windows XP, meaning that most devices 
are probably untested in this situation. This patch alters the behaviour 
to match that of Windows. Userspace can still whitelist devices as 
appropriate, and the set of classes supporting autosuspend probably 
covers pretty much every driver likely to be found on any portable 
device.

Signed-off-by: Matthew Garrett <mjg59@srcf.ucam.org>

---

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index caaa46f..12ba789 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1278,6 +1278,22 @@ int usb_new_device(struct usb_device *udev)
 {
 	int err;
 
+#ifdef CONFIG_USB_SUSPEND
+	/* Disable autosuspend for most devices - Windows only enables it
+	   for a small subset of classes, so most hardware hasn't been tested
+	   with it. Userspace can always reenable at a later point */
+
+	switch (udev->descriptor.bDeviceClass) {
+	case USB_CLASS_HID:
+	case USB_CLASS_COMM:
+	case USB_CLASS_WIRELESS_CONTROLLER:
+	case USB_CLASS_HUB:
+		break;
+	default:
+		udev->autosuspend_disabled = 1;
+	}
+#endif
+
 	/* Determine quirks */
 	usb_detect_quirks(udev);


-- 
Matthew Garrett | mjg59@srcf.ucam.org

^ permalink raw reply related	[flat|nested] 56+ messages in thread

end of thread, other threads:[~2007-08-07  9:15 UTC | newest]

Thread overview: 56+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-02 23:56 [PATCH] USB: Only enable autosuspend by default on certain device classes Matthew Garrett
2007-08-03  1:15 ` Greg KH
2007-08-03  1:47   ` Matthew Garrett
2007-08-03  2:46     ` [linux-usb-devel] " Alan Stern
2007-08-03  6:01       ` David Brownell
2007-08-03 11:28         ` Matthew Garrett
2007-08-03 11:44           ` Oliver Neukum
2007-08-03 12:04             ` Matthew Garrett
2007-08-03 12:26               ` Rogan Dawes
2007-08-03 12:32                 ` Matthew Garrett
2007-08-03 14:01                   ` David Brownell
2007-08-03 14:09                     ` Matthew Garrett
2007-08-03 14:28                       ` Alan Stern
2007-08-03 14:33                         ` Matthew Garrett
2007-08-03 14:41                           ` Alan Stern
2007-08-03 15:10                             ` Matthew Garrett
2007-08-03 14:43                           ` Jiri Kosina
2007-08-03 14:53                             ` [linux-usb-devel] " Dave Jones
2007-08-03 14:58                               ` Jiri Kosina
2007-08-03 15:24                               ` David Brownell
2007-08-03 15:29                                 ` Jiri Kosina
2007-08-03 17:47                                   ` Alan Stern
2007-08-03 15:25                               ` Adam Kropelin
2007-08-03 15:31                                 ` Jiri Kosina
2007-08-03 15:48                                   ` Dave Jones
2007-08-03 16:49                                     ` David Brownell
2007-08-03 16:55                                     ` Adam Kropelin
2007-08-03 15:06                             ` Matthew Garrett
2007-08-03 14:37                       ` [linux-usb-devel] " David Brownell
2007-08-03 15:03                         ` Matthew Garrett
2007-08-03 16:08                           ` Oliver Neukum
2007-08-03 17:49                             ` Alan Stern
2007-08-03 20:03                             ` Dave Jones
2007-08-03 16:29                           ` David Brownell
2007-08-03 16:50                             ` Matthew Garrett
2007-08-03 17:49                             ` Greg KH
2007-08-03 17:44                   ` Greg KH
2007-08-03 17:48                     ` Matthew Garrett
2007-08-03 19:29                       ` Chuck Ebbert
2007-08-03 19:56                         ` Pete Zaitcev
2007-08-07  9:14                           ` Amit Kucheria
2007-08-03 20:12                     ` [linux-usb-devel] " Dave Jones
2007-08-03 21:17                       ` Alan Stern
2007-08-03 21:31                         ` Dave Jones
2007-08-03 21:33                         ` Matthew Garrett
2007-08-03 12:34                 ` Felipe Balbi
2007-08-03  6:06     ` David Brownell
2007-08-03 14:22       ` Dave Jones
2007-08-03 14:52         ` David Brownell
2007-08-03  7:57     ` Oliver Neukum
2007-08-03 14:24       ` Dave Jones
2007-08-03 14:32         ` Oliver Neukum
2007-08-03 14:36           ` [linux-usb-devel] [PATCH] USB: Only enable autosuspend by?default " Dave Jones
2007-08-03 19:34         ` [linux-usb-devel] [PATCH] USB: Only enable autosuspend by default " Pete Zaitcev
2007-08-03 19:45           ` Dave Jones
2007-08-03 20:04             ` Pete Zaitcev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox