Name

usb_reset_device — perform a USB port reset to reinitialize a device

Synopsis

int usb_reset_device (struct usb_device * udev);

Arguments

udev

device to reset (not in SUSPENDED or NOTATTACHED state)

Description

WARNING - don't reset any device unless drivers for all of its interfaces are expecting that reset! Maybe some driver->reset method should eventually help ensure sufficient cooperation.

Do a port reset, reassign the device's address, and establish its former operating configuration. If the reset fails, or the device's descriptors change from their values before the reset, or the original configuration and altsettings cannot be restored, a flag will be set telling khubd to pretend the device has been disconnected and then re-connected. All drivers will be unbound, and the device will be re-enumerated and probed all over again.

Returns 0 if the reset succeeded, -ENODEV if the device has been flagged for logical disconnection, or some other negative error code if the reset wasn't even attempted.

The caller must own the device lock. For example, it's safe to use this from a driver probe routine after downloading new firmware. For calls that might not occur during probe, drivers should lock the device using usb_lock_device_for_reset.