Fixed inability to enumerate any devices while in host mode (broken in a previous...
authorDean Camera <dean@fourwalledcubicle.com>
Thu, 7 May 2009 05:30:19 +0000 (05:30 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Thu, 7 May 2009 05:30:19 +0000 (05:30 +0000)
LUFA/Drivers/USB/HighLevel/USBTask.c
LUFA/Drivers/USB/LowLevel/DevChapter9.c
LUFA/Drivers/USB/LowLevel/Host.h

index 738dc15..5202cc8 100644 (file)
@@ -83,12 +83,11 @@ static void USB_HostTask(void)
 {\r
        uint8_t ErrorCode    = HOST_ENUMERROR_NoError;\r
        uint8_t SubErrorCode = HOST_ENUMERROR_NoError;\r
 {\r
        uint8_t ErrorCode    = HOST_ENUMERROR_NoError;\r
        uint8_t SubErrorCode = HOST_ENUMERROR_NoError;\r
+       uint8_t PrevPipe     = Pipe_GetCurrentPipe();\r
        \r
        static uint16_t WaitMSRemaining;\r
        static uint8_t  PostWaitState;\r
 \r
        \r
        static uint16_t WaitMSRemaining;\r
        static uint8_t  PostWaitState;\r
 \r
-       uint8_t PrevPipe = Pipe_GetCurrentPipe();\r
-\r
        Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
 \r
        switch (USB_HostState)\r
        Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
 \r
        switch (USB_HostState)\r
@@ -176,10 +175,10 @@ static void USB_HostTask(void)
                                        .bRequest      = REQ_GetDescriptor,\r
                                        .wValue        = (DTYPE_Device << 8),\r
                                        .wIndex        = 0,\r
                                        .bRequest      = REQ_GetDescriptor,\r
                                        .wValue        = (DTYPE_Device << 8),\r
                                        .wIndex        = 0,\r
-                                       .wLength       = PIPE_CONTROLPIPE_DEFAULT_SIZE,\r
+                                       .wLength       = 8,\r
                                };\r
 \r
                                };\r
 \r
-                       uint8_t DataBuffer[PIPE_CONTROLPIPE_DEFAULT_SIZE];\r
+                       uint8_t DataBuffer[8];\r
 \r
                        if ((SubErrorCode = USB_Host_SendControlRequest(DataBuffer)) != HOST_SENDCONTROL_Successful)\r
                        {\r
 \r
                        if ((SubErrorCode = USB_Host_SendControlRequest(DataBuffer)) != HOST_SENDCONTROL_Successful)\r
                        {\r
index f02d32b..f02bb56 100644 (file)
@@ -165,7 +165,7 @@ static void USB_Device_SetConfiguration(void)
 \r
 void USB_Device_GetConfiguration(void)\r
 {\r
 \r
 void USB_Device_GetConfiguration(void)\r
 {\r
-       Endpoint_ClearSETUP();  \r
+       Endpoint_ClearSETUP();\r
 \r
        Endpoint_Write_Byte(USB_ConfigurationNumber);\r
        \r
 \r
        Endpoint_Write_Byte(USB_ConfigurationNumber);\r
        \r
index b1d60af..9ce995f 100644 (file)
@@ -60,7 +60,7 @@
                         *  and that the address used is not important (other than the fact that it is non-zero), a\r
                         *  fixed value is specified by the library.\r
                         */\r
                         *  and that the address used is not important (other than the fact that it is non-zero), a\r
                         *  fixed value is specified by the library.\r
                         */\r
-                       #define USB_HOST_DEVICEADDRESS             1\r
+                       #define USB_HOST_DEVICEADDRESS                 1\r
 \r
                        #if !defined(USB_HOST_TIMEOUT_MS) || defined(__DOXYGEN__)\r
                                /** Constant for the maximum software timeout period of sent USB control transactions to an attached\r
 \r
                        #if !defined(USB_HOST_TIMEOUT_MS) || defined(__DOXYGEN__)\r
                                /** Constant for the maximum software timeout period of sent USB control transactions to an attached\r
                        #define USB_Host_HostMode_On()          MACROS{ USBCON |=  (1 << HOST);           }MACROE\r
                        #define USB_Host_HostMode_Off()         MACROS{ USBCON &= ~(1 << HOST);           }MACROE\r
 \r
                        #define USB_Host_HostMode_On()          MACROS{ USBCON |=  (1 << HOST);           }MACROE\r
                        #define USB_Host_HostMode_Off()         MACROS{ USBCON &= ~(1 << HOST);           }MACROE\r
 \r
-                       #define USB_Host_VBUS_Auto_Enable()     MACROS{ OTGCON &= ~(1 << VBUSHWC); UHWCON |=  (1 << UVCONE);                    }MACROE\r
+                       #define USB_Host_VBUS_Auto_Enable()     MACROS{ OTGCON &= ~(1 << VBUSHWC); UHWCON |=  (1 << UVCONE);                   }MACROE\r
                        #define USB_Host_VBUS_Manual_Enable()   MACROS{ OTGCON |=  (1 << VBUSHWC); UHWCON &= ~(1 << UVCONE); DDRE |= (1 << 7); }MACROE\r
 \r
                        #define USB_Host_VBUS_Auto_On()         MACROS{ OTGCON |= (1 << VBUSREQ);         }MACROE\r
                        #define USB_Host_VBUS_Manual_Enable()   MACROS{ OTGCON |=  (1 << VBUSHWC); UHWCON &= ~(1 << UVCONE); DDRE |= (1 << 7); }MACROE\r
 \r
                        #define USB_Host_VBUS_Auto_On()         MACROS{ OTGCON |= (1 << VBUSREQ);         }MACROE\r