Oops - fix include directory for case-sensitive filesystems.
[pub/USBasp.git] / LUFA / Drivers / USB / Class / Device / HID.c
index 0bf1f70..1b3e4fb 100644 (file)
@@ -9,13 +9,13 @@
 /*\r
   Copyright 2009  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
 \r
 /*\r
   Copyright 2009  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
 \r
-  Permission to use, copy, modify, and distribute this software\r
-  and its documentation for any purpose and without fee is hereby\r
-  granted, provided that the above copyright notice appear in all\r
-  copies and that both that the copyright notice and this\r
-  permission notice and warranty disclaimer appear in supporting\r
-  documentation, and that the name of the author not be used in\r
-  advertising or publicity pertaining to distribution of the\r
+  Permission to use, copy, modify, distribute, and sell this \r
+  software and its documentation for any purpose is hereby granted\r
+  without fee, provided that the above copyright notice appear in \r
+  all copies and that both that the copyright notice and this\r
+  permission notice and warranty disclaimer appear in supporting \r
+  documentation, and that the name of the author not be used in \r
+  advertising or publicity pertaining to distribution of the \r
   software without specific, written prior permission.\r
 \r
   The author disclaim all warranties with regard to this\r
   software without specific, written prior permission.\r
 \r
   The author disclaim all warranties with regard to this\r
@@ -50,10 +50,11 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
 \r
                                uint16_t ReportINSize = 0;\r
                                uint8_t  ReportID     = (USB_ControlRequest.wValue & 0xFF);\r
 \r
                                uint16_t ReportINSize = 0;\r
                                uint8_t  ReportID     = (USB_ControlRequest.wValue & 0xFF);\r
+                               uint8_t  ReportType   = (USB_ControlRequest.wValue >> 8) - 1;\r
 \r
                                memset(HIDInterfaceInfo->Config.PrevReportINBuffer, 0, HIDInterfaceInfo->Config.PrevReportINBufferSize);\r
                                \r
 \r
                                memset(HIDInterfaceInfo->Config.PrevReportINBuffer, 0, HIDInterfaceInfo->Config.PrevReportINBufferSize);\r
                                \r
-                               CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID,\r
+                               CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, ReportType,\r
                                                                    HIDInterfaceInfo->Config.PrevReportINBuffer, &ReportINSize);\r
 \r
                                Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);\r
                                                                    HIDInterfaceInfo->Config.PrevReportINBuffer, &ReportINSize);\r
 \r
                                Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);\r
@@ -95,7 +96,7 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
                        {\r
                                Endpoint_ClearSETUP();\r
 \r
                        {\r
                                Endpoint_ClearSETUP();\r
 \r
-                               HIDInterfaceInfo->State.UsingReportProtocol = (USB_ControlRequest.wValue != 0x0000);\r
+                               HIDInterfaceInfo->State.UsingReportProtocol = ((USB_ControlRequest.wValue & 0xFF) != 0x00);\r
                                \r
                                Endpoint_ClearStatusStage();\r
                        }\r
                                \r
                                Endpoint_ClearStatusStage();\r
                        }\r
@@ -158,7 +159,8 @@ void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
 \r
                memset(ReportINData, 0, sizeof(ReportINData));\r
 \r
 \r
                memset(ReportINData, 0, sizeof(ReportINData));\r
 \r
-               bool ForceSend         = CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, ReportINData, &ReportINSize);\r
+               bool ForceSend         = CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, REPORT_ITEM_TYPE_In,\r
+                                                                            ReportINData, &ReportINSize);\r
                bool StatesChanged     = false;\r
                bool IdlePeriodElapsed = (HIDInterfaceInfo->State.IdleCount && !(HIDInterfaceInfo->State.IdleMSRemaining));\r
                \r
                bool StatesChanged     = false;\r
                bool IdlePeriodElapsed = (HIDInterfaceInfo->State.IdleCount && !(HIDInterfaceInfo->State.IdleMSRemaining));\r
                \r