summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2008-12-01 10:24:41 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-12-17 10:49:14 -0800
commit24c0996a6b73e2554104961afcc8659534503e0d (patch)
treece806aca4dbe0b236a639a9067615594f8cdedf6
parent9a9fafb89433c5fd1331bac0c84c4b321e358b42 (diff)
downloadop-kernel-dev-24c0996a6b73e2554104961afcc8659534503e0d.zip
op-kernel-dev-24c0996a6b73e2554104961afcc8659534503e0d.tar.gz
USB: skip Set-Interface(0) if already in altsetting 0
When a driver unbinds from an interface, usbcore always sends a Set-Interface request to reinstall altsetting 0. Unforunately, quite a few devices have buggy firmware that crashes when it receives this request. To avoid such problems, this patch (as1180) arranges to send the Set-Interface request only when the interface is not already in altsetting 0. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/core/driver.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 3d7793d..8c08130 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -279,7 +279,9 @@ static int usb_unbind_interface(struct device *dev)
* altsetting means creating new endpoint device entries).
* When either of these happens, defer the Set-Interface.
*/
- if (!error && intf->dev.power.status == DPM_ON)
+ if (intf->cur_altsetting->desc.bAlternateSetting == 0)
+ ; /* Already in altsetting 0 so skip Set-Interface */
+ else if (!error && intf->dev.power.status == DPM_ON)
usb_set_interface(udev, intf->altsetting[0].
desc.bInterfaceNumber, 0);
else
OpenPOWER on IntegriCloud