Re-add in old Endpoint/Pipe workaround for unordered pipes - add new ORDERED_EP_CONFI...
[pub/USBasp.git] / Demos / Device / LowLevel / GenericHID / GenericHID.c
index d7c2e37..f6dcd78 100644 (file)
@@ -3,7 +3,7 @@
      Copyright (C) Dean Camera, 2010.
 
   dean [at] fourwalledcubicle [dot] com
-      www.fourwalledcubicle.com
+           www.lufa-lib.org
 */
 
 /*
@@ -107,16 +107,16 @@ void EVENT_USB_Device_ConfigurationChanged(void)
        LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
 }
 
-/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific
- *  control requests that are not handled internally by the USB library (including the HID commands, which are
- *  all issued via the control endpoint), so that they can be handled appropriately for the application.
+/** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to
+ *  the device from the USB host before passing along unhandled control requests to the library for processing
+ *  internally.
  */
-void EVENT_USB_Device_UnhandledControlRequest(void)
+void EVENT_USB_Device_ControlRequest(void)
 {
        /* Handle HID Class specific requests */
        switch (USB_ControlRequest.bRequest)
        {
-               case REQ_GetReport:
+               case HID_REQ_GetReport:
                        if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
                        {
                                uint8_t GenericData[GENERIC_REPORT_SIZE];
@@ -130,7 +130,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
                        }
 
                        break;
-               case REQ_SetReport:
+               case HID_REQ_SetReport:
                        if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
                        {
                                uint8_t GenericData[GENERIC_REPORT_SIZE];
@@ -139,7 +139,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
 
                                /* Read the report data from the control endpoint */
                                Endpoint_Read_Control_Stream_LE(&GenericData, sizeof(GenericData));
-                               Endpoint_ClearOUT();
+                               Endpoint_ClearIN();
 
                                ProcessGenericHIDReport(GenericData);
                        }