Device mode class driver callbacks are now fired before the control request status...
[pub/USBasp.git] / Projects / XPLAINBridge / XPLAINBridge.c
index e5b282e..5457a22 100644 (file)
@@ -81,6 +81,7 @@ int main(void)
        Buffer_Initialize(&UARTtoUSB_Buffer);\r
 \r
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
        Buffer_Initialize(&UARTtoUSB_Buffer);\r
 \r
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+       sei();\r
 \r
        for (;;)\r
        {\r
 \r
        for (;;)\r
        {\r
@@ -99,7 +100,7 @@ void AVRISP_Task(void)
        if (USB_DeviceState != DEVICE_STATE_Configured)\r
          return;\r
 \r
        if (USB_DeviceState != DEVICE_STATE_Configured)\r
          return;\r
 \r
-       Endpoint_SelectEndpoint(AVRISP_DATA_EPNUM);\r
+       Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPNUM);\r
        \r
        /* Check to see if a V2 Protocol command has been received */\r
        if (Endpoint_IsOUTReceived())\r
        \r
        /* Check to see if a V2 Protocol command has been received */\r
        if (Endpoint_IsOUTReceived())\r
@@ -178,18 +179,24 @@ void SetupHardware(void)
 /** Event handler for the library USB Configuration Changed event. */\r
 void EVENT_USB_Device_ConfigurationChanged(void)\r
 {\r
 /** Event handler for the library USB Configuration Changed event. */\r
 void EVENT_USB_Device_ConfigurationChanged(void)\r
 {\r
-       bool EndpointConfigSuccess;\r
+       bool EndpointConfigSuccess = true;\r
 \r
        /* Configure the device endpoints according to the selected mode */\r
        if (CurrentFirmwareMode == MODE_USART_BRIDGE)\r
        {\r
 \r
        /* Configure the device endpoints according to the selected mode */\r
        if (CurrentFirmwareMode == MODE_USART_BRIDGE)\r
        {\r
-               EndpointConfigSuccess = CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface);\r
+               EndpointConfigSuccess &= CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface);\r
        }\r
        else\r
        {\r
        }\r
        else\r
        {\r
-               EndpointConfigSuccess = Endpoint_ConfigureEndpoint(AVRISP_DATA_EPNUM, EP_TYPE_BULK,\r
-                                                                                                  ENDPOINT_DIR_OUT, AVRISP_DATA_EPSIZE,\r
-                                                                                                  ENDPOINT_BANK_SINGLE);\r
+               EndpointConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_OUT_EPNUM, EP_TYPE_BULK,\r
+                                                                                                   ENDPOINT_DIR_OUT, AVRISP_DATA_EPSIZE,\r
+                                                                                                   ENDPOINT_BANK_SINGLE);\r
+\r
+               #if defined(LIBUSB_FILTERDRV_COMPAT)\r
+               EndpointConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPNUM, EP_TYPE_BULK,\r
+                                                                   ENDPOINT_DIR_IN, AVRISP_DATA_EPSIZE,\r
+                                                                   ENDPOINT_BANK_SINGLE);\r
+               #endif\r
        }\r
 \r
        if (EndpointConfigSuccess)\r
        }\r
 \r
        if (EndpointConfigSuccess)\r