We need to be able to call ep0_reinit() [renamed to usb_ep0_reinit()] from the WUSB security code. The reason is that when we authenticate the device, it's address changes (from having bit 7 set to having it cleared). Thus, we need to signal the USB stack to reinitialize EP0, so the status with the previous address kept at the HCD layer is cleared and properly reinitialized.
Signed-off-by: Inaky Perez-Gonzalez <[EMAIL PROTECTED]> --- Index: linux.hg/drivers/usb/core/hub.c =================================================================== --- linux.hg.orig/drivers/usb/core/hub.c 2007-07-31 12:19:00.000000000 -0700 +++ linux.hg/drivers/usb/core/hub.c 2007-07-31 12:19:03.000000000 -0700 @@ -2125,12 +2125,13 @@ return portstatus; } -static void ep0_reinit(struct usb_device *udev) +void usb_ep0_reinit(struct usb_device *udev) { usb_disable_endpoint(udev, 0 + USB_DIR_IN); usb_disable_endpoint(udev, 0 + USB_DIR_OUT); udev->ep_in[0] = udev->ep_out[0] = &udev->ep0; } +EXPORT_SYMBOL_GPL(usb_ep0_reinit); #define usb_sndaddr0pipe() (PIPE_CONTROL << 30) #define usb_rcvaddr0pipe() ((PIPE_CONTROL << 30) | USB_DIR_IN) @@ -2150,7 +2151,7 @@ NULL, 0, USB_CTRL_SET_TIMEOUT); if (retval == 0) { usb_set_device_state(udev, USB_STATE_ADDRESS); - ep0_reinit(udev); + usb_ep0_reinit(udev); } return retval; } @@ -2384,7 +2385,7 @@ } dev_dbg(&udev->dev, "ep0 maxpacket = %d\n", i); udev->ep0.desc.wMaxPacketSize = cpu_to_le16(i); - ep0_reinit(udev); + usb_ep0_reinit(udev); } retval = usb_get_device_descriptor(udev, USB_DT_DEVICE_SIZE); @@ -2637,7 +2638,7 @@ loop_disable: hub_port_disable(hub, port1, 1); loop: - ep0_reinit(udev); + usb_ep0_reinit(udev); release_address(udev); usb_put_dev(udev); if ((status == -ENOTCONN) || (status == -ENOTSUPP)) @@ -3033,7 +3034,7 @@ /* ep0 maxpacket size may change; let the HCD know about it. * Other endpoints will be handled by re-enumeration. */ - ep0_reinit(udev); + usb_ep0_reinit(udev); ret = hub_port_init(parent_hub, udev, port1, i); if (ret >= 0 || ret == -ENOTCONN || ret == -ENODEV) break; Index: linux.hg/drivers/usb/core/hub.h =================================================================== --- linux.hg.orig/drivers/usb/core/hub.h 2007-07-31 12:18:11.000000000 -0700 +++ linux.hg/drivers/usb/core/hub.h 2007-07-31 12:19:03.000000000 -0700 @@ -191,5 +191,6 @@ }; extern void usb_hub_tt_clear_buffer (struct usb_device *dev, int pipe); +extern void usb_ep0_reinit(struct usb_device *); #endif /* __LINUX_HUB_H */ -- Inaky ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel