Rename UC3B driver files to UC3, as they are generic to all AVR32 UC3 models.
[pub/USBasp.git] / LUFA / Drivers / USB / Class / Device / HID.c
index 91a4f7a..505b66e 100644 (file)
@@ -1,13 +1,13 @@
 /*
              LUFA Library
 /*
              LUFA Library
-     Copyright (C) Dean Camera, 2010.
+     Copyright (C) Dean Camera, 2011.
 
   dean [at] fourwalledcubicle [dot] com
 
   dean [at] fourwalledcubicle [dot] com
-      www.fourwalledcubicle.com
+           www.lufa-lib.org
 */
 
 /*
 */
 
 /*
-  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)
+  Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
@@ -29,7 +29,8 @@
 */
 
 #define  __INCLUDE_FROM_USB_DRIVER
 */
 
 #define  __INCLUDE_FROM_USB_DRIVER
-#include "../../HighLevel/USBMode.h"
+#include "../../Core/USBMode.h"
+
 #if defined(USB_CAN_BE_DEVICE)
 
 #define  __INCLUDE_FROM_HID_DRIVER
 #if defined(USB_CAN_BE_DEVICE)
 
 #define  __INCLUDE_FROM_HID_DRIVER
@@ -59,8 +60,11 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
                                CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, ReportType, ReportData, &ReportSize);
 
                                if (HIDInterfaceInfo->Config.PrevReportINBuffer != NULL)
                                CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, ReportType, ReportData, &ReportSize);
 
                                if (HIDInterfaceInfo->Config.PrevReportINBuffer != NULL)
-                                 memcpy(HIDInterfaceInfo->Config.PrevReportINBuffer, ReportData, HIDInterfaceInfo->Config.PrevReportINBufferSize);
-
+                               {
+                                       memcpy(HIDInterfaceInfo->Config.PrevReportINBuffer, ReportData,
+                                              HIDInterfaceInfo->Config.PrevReportINBufferSize);
+                               }
+                               
                                Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
 
                                Endpoint_ClearSETUP();
                                Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
 
                                Endpoint_ClearSETUP();
@@ -80,8 +84,9 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
                                Endpoint_ClearSETUP();
                                Endpoint_Read_Control_Stream_LE(ReportData, ReportSize);
                                Endpoint_ClearIN();
                                Endpoint_ClearSETUP();
                                Endpoint_Read_Control_Stream_LE(ReportData, ReportSize);
                                Endpoint_ClearIN();
-
-                               CALLBACK_HID_Device_ProcessHIDReport(HIDInterfaceInfo, ReportID, ReportType, ReportData, ReportSize);
+                               
+                               CALLBACK_HID_Device_ProcessHIDReport(HIDInterfaceInfo, ReportID, ReportType,
+                                                                    &ReportData[ReportID ? 1 : 0], ReportSize - (ReportID ? 1 : 0));
                        }
 
                        break;
                        }
 
                        break;
@@ -179,7 +184,7 @@ void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
                        if (ReportID)
                          Endpoint_Write_Byte(ReportID);
 
                        if (ReportID)
                          Endpoint_Write_Byte(ReportID);
 
-                       Endpoint_Write_Stream_LE(ReportINData, ReportINSize, NO_STREAM_CALLBACK);
+                       Endpoint_Write_Stream_LE(ReportINData, ReportINSize, NULL);
 
                        Endpoint_ClearIN();
                }
 
                        Endpoint_ClearIN();
                }