Commit 251c4078 authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[PATCH] USB: bugfix endpoint state

This resolves some problems in the endpoint disable
patch I sent recently:

  - wasn't un-halting some endpoints
  - was clobbering ep0 setup in some cases.
parent 1069b435
...@@ -672,6 +672,7 @@ void usb_set_maxpacket(struct usb_device *dev) ...@@ -672,6 +672,7 @@ void usb_set_maxpacket(struct usb_device *dev)
{ {
int i, b; int i, b;
/* NOTE: affects all endpoints _except_ ep0 */
for (i=0; i<dev->actconfig->desc.bNumInterfaces; i++) { for (i=0; i<dev->actconfig->desc.bNumInterfaces; i++) {
struct usb_interface *ifp = dev->actconfig->interface + i; struct usb_interface *ifp = dev->actconfig->interface + i;
struct usb_host_interface *as = ifp->altsetting + ifp->act_altsetting; struct usb_host_interface *as = ifp->altsetting + ifp->act_altsetting;
...@@ -862,6 +863,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) ...@@ -862,6 +863,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
usb_settoggle (dev, ep, out, 0); usb_settoggle (dev, ep, out, 0);
(out ? dev->epmaxpacketout : dev->epmaxpacketin) [ep] (out ? dev->epmaxpacketout : dev->epmaxpacketin) [ep]
= iface_as->endpoint [i].desc.wMaxPacketSize; = iface_as->endpoint [i].desc.wMaxPacketSize;
usb_endpoint_running (dev, ep, out);
} }
return 0; return 0;
...@@ -916,7 +918,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration) ...@@ -916,7 +918,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
/* if it's already configured, clear out old state first. */ /* if it's already configured, clear out old state first. */
if (dev->state != USB_STATE_ADDRESS && disable) { if (dev->state != USB_STATE_ADDRESS && disable) {
for (i = 0; i < 15; i++) { for (i = 1 /* skip ep0 */; i < 15; i++) {
disable (dev, i); disable (dev, i);
disable (dev, USB_DIR_IN | i); disable (dev, USB_DIR_IN | i);
} }
......
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