uint8_t USBHostSetDeviceConfiguration( uint8_t deviceAddress, uint8_t configuration );
This function is used by the application to change the device's Configuration. This function must be used instead of USBHostIssueDeviceRequest(), because the endpoint definitions may change.
To see when the reconfiguration is complete, use the USBHostDeviceStatus() function. If configuration is still in progress, this function will return USB_DEVICE_ENUMERATING.
The host state machine should be in the running state, and no reads or writes should be in progress.
Return Values |
Description |
USB_SUCCESS |
Process of changing the configuration was started successfully. |
USB_UNKNOWN_DEVICE |
Device not found |
USB_INVALID_STATE |
This function cannot be called during enumeration or while performing a device request. |
USB_BUSY |
No IN or OUT transfers may be in progress. |
If an invalid configuration is specified, this function cannot return an error. Instead, the event USB_UNSUPPORTED_DEVICE will the sent to the application layer and the device will be placed in a holding state with a USB_HOLDING_UNSUPPORTED_DEVICE error returned by USBHostDeviceStatus().
rc = USBHostSetDeviceConfiguration( attachedDevice, configuration ); if (rc) { // Error - cannot set configuration. } else { while (USBHostDeviceStatus( attachedDevice ) == USB_DEVICE_ENUMERATING) { USBHostTasks(); } } if (USBHostDeviceStatus( attachedDevice ) != USB_DEVICE_ATTACHED) { // Error - cannot set configuration. }
MLA - USB Library Help Version : 2.16
![]() |