Jump to main content

##

# 2.2.4.17 USB_DEVICE_Detach Function

## C

    void USB_DEVICE_Detach(
        USB_DEVICE_HANDLE usbDeviceHandle
    );

## Summary

This function will detach the device from the USB. It does this by disabling the pull up resistors on the D+ or D- lines. This function should be called when the application wants to disconnect the device from the bus (typically to implement a soft detach or switch to host mode operation). It should be called when the Device Layer has generated the USB_DEVICE_EVENT_POWER_REMOVED event.

## Precondition

The device layer should have been initialized and opened.

## Parameters

Parameters | Description
usbDeviceHandle | Client's driver handle (returned from USB_DEVICE_Open)

## Returns

None.

## Example

    USB_DEVICE_HANDLE usbDeviceHandle;

    // Detach the device from the USB
    USB_DEVICE_Detach( usbDeviceHandle );

## Remarks

None.