USB Device Driver Attach Processing
After the USBD module loads a USB device driver for a peripheral, it calls the driver’s USBDeviceAttach function. In this function, the driver performs the following operations:
- Determines whether it can control the peripheral. If the driver can control the peripheral, it returns TRUE to accept control. Otherwise, the driver returns FALSE to decline control. In the latter case, the USBD module continues to search for other drivers to control the peripheral.
- Loads additional USB device drivers for other interfaces that may be present on the peripheral by calling the LoadGenericInterfaceDriver function. If a USB device driver accepts control of a peripheral, the USBD module stops searching for drivers to control the peripheral. The driver that accepts control must then load any other USB device drivers for other interfaces present on the peripheral.
- Registers a callback function that is called when the peripheral is disconnected from the bus. USB device drivers use the RegisterNotificationRoutine function to register callback functions.