usb_reset_device
Prev | Chapter 5. USB Core APIs | Next

## 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 use this routine to reset a composite device (one with multiple interfaces owned by separate drivers)! Use `usb_reset_composite_device` instead.

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`.

## Locking exception

This routine may also be called from within an autoresume handler. Such usage won't conflict with other tasks holding the device lock because these tasks should always call `usb_autopm_resume_device`, thereby preventing any unwanted autoresume.

Prev | Up | Next
usb_root_hub_lost_power | Home | usb_reset_composite_device