Commit 24c0996a authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

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: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 9a9fafb8
...@@ -279,7 +279,9 @@ static int usb_unbind_interface(struct device *dev) ...@@ -279,7 +279,9 @@ static int usb_unbind_interface(struct device *dev)
* altsetting means creating new endpoint device entries). * altsetting means creating new endpoint device entries).
* When either of these happens, defer the Set-Interface. * 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]. usb_set_interface(udev, intf->altsetting[0].
desc.bInterfaceNumber, 0); desc.bInterfaceNumber, 0);
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment