diff options
| author | Dean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28> | 2009-06-16 04:20:21 +0000 |
|---|---|---|
| committer | Dean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28> | 2009-06-16 04:20:21 +0000 |
| commit | e2a9e796c8d339c088028f222adfc9ff4b48ca7d (patch) | |
| tree | 73449296c9effce9ba73cf744734e258edfbdfea /Demos/Host/LowLevel/MassStorageHost/MassStorageHost.c | |
| parent | c5d00e13be875407e3088de6dd1a010752bd6639 (diff) | |
Added new USB_Host_SetDeviceConfiguration() convenience function. Change over Low Level host demos to use the new routine.
git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@603 d5102386-fcda-11dd-9fdb-3debd5008f28
Diffstat (limited to 'Demos/Host/LowLevel/MassStorageHost/MassStorageHost.c')
| -rw-r--r-- | Demos/Host/LowLevel/MassStorageHost/MassStorageHost.c | 47 |
1 files changed, 17 insertions, 30 deletions
diff --git a/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.c b/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.c index 354a75fc..905077e8 100644 --- a/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.c +++ b/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.c @@ -138,36 +138,6 @@ void MassStorage_Task(void) switch (USB_HostState)
{
case HOST_STATE_Addressed:
- /* Standard request to set the device configuration to configuration 1 */
- USB_ControlRequest = (USB_Request_Header_t)
- {
- .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE),
- .bRequest = REQ_SetConfiguration,
- .wValue = 1,
- .wIndex = 0,
- .wLength = 0,
- };
-
- /* Select the control pipe for the request transfer */
- Pipe_SelectPipe(PIPE_CONTROLPIPE);
-
- /* Send the request, display error and wait for device detach if request fails */
- if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)
- {
- puts_P(PSTR("Control Error (Set Configuration).\r\n"));
- printf_P(PSTR(" -- Error Code: %d\r\n"), ErrorCode);
-
- /* Indicate error via status LEDs */
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-
- /* Wait until USB device disconnected */
- while (USB_IsConnected);
- break;
- }
-
- USB_HostState = HOST_STATE_Configured;
- break;
- case HOST_STATE_Configured:
puts_P(PSTR("Getting Config Data.\r\n"));
/* Get and process the configuration descriptor data */
@@ -188,6 +158,23 @@ void MassStorage_Task(void) break;
}
+ /* Set the device configuration to the first configuration (rarely do devices use multiple configurations) */
+ if ((ErrorCode = USB_Host_SetDeviceConfiguration(1)) != HOST_SENDCONTROL_Successful)
+ {
+ puts_P(PSTR("Control Error (Set Configuration).\r\n"));
+ printf_P(PSTR(" -- Error Code: %d\r\n"), ErrorCode);
+
+ /* Indicate error via status LEDs */
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+
+ /* Wait until USB device disconnected */
+ while (USB_IsConnected);
+ break;
+ }
+
+ USB_HostState = HOST_STATE_Configured;
+ break;
+ case HOST_STATE_Configured:
puts_P(PSTR("Mass Storage Disk Enumerated.\r\n"));
USB_HostState = HOST_STATE_Ready;
|
