diff --git a/Demos/Device/ClassDriver/CDCMouse/CDCMouse.c b/Demos/Device/ClassDriver/CDCMouse/CDCMouse.c index e21e0bcb4e..3c7fe5b81b 100644 --- a/Demos/Device/ClassDriver/CDCMouse/CDCMouse.c +++ b/Demos/Device/ClassDriver/CDCMouse/CDCMouse.c @@ -198,7 +198,7 @@ void EVENT_USB_Device_StartOfFrame(void) * \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent */ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, - void* ReportData, uint16_t* ReportSize) + const uint8_t ReportType, void* ReportData, uint16_t* ReportSize) { USB_MouseReport_Data_t* MouseReport = (USB_MouseReport_Data_t*)ReportData; diff --git a/Demos/Device/ClassDriver/CDCMouse/CDCMouse.h b/Demos/Device/ClassDriver/CDCMouse/CDCMouse.h index 002fe3be99..bee1b04350 100644 --- a/Demos/Device/ClassDriver/CDCMouse/CDCMouse.h +++ b/Demos/Device/ClassDriver/CDCMouse/CDCMouse.h @@ -76,7 +76,7 @@ void EVENT_USB_Device_StartOfFrame(void); bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, - void* ReportData, uint16_t* ReportSize); + const uint8_t ReportType, void* ReportData, uint16_t* ReportSize); void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID, const void* ReportData, const uint16_t ReportSize); #endif diff --git a/Demos/Device/ClassDriver/GenericHID/GenericHID.c b/Demos/Device/ClassDriver/GenericHID/GenericHID.c index 5e265805f6..7ff886e73e 100644 --- a/Demos/Device/ClassDriver/GenericHID/GenericHID.c +++ b/Demos/Device/ClassDriver/GenericHID/GenericHID.c @@ -142,7 +142,7 @@ void EVENT_USB_Device_StartOfFrame(void) * \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent */ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, - void* ReportData, uint16_t* ReportSize) + const uint8_t ReportType, void* ReportData, uint16_t* ReportSize) { if (HIDReportEcho.ReportID) *ReportID = HIDReportEcho.ReportID; diff --git a/Demos/Device/ClassDriver/GenericHID/GenericHID.h b/Demos/Device/ClassDriver/GenericHID/GenericHID.h index 004daf54af..4a13c426fe 100644 --- a/Demos/Device/ClassDriver/GenericHID/GenericHID.h +++ b/Demos/Device/ClassDriver/GenericHID/GenericHID.h @@ -72,7 +72,7 @@ void EVENT_USB_Device_StartOfFrame(void); bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, - void* ReportData, uint16_t* ReportSize); + const uint8_t ReportType, void* ReportData, uint16_t* ReportSize); void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID, const void* ReportData, const uint16_t ReportSize); diff --git a/Demos/Device/ClassDriver/Joystick/Joystick.c b/Demos/Device/ClassDriver/Joystick/Joystick.c index 00bcb6fe42..987fe1055e 100644 --- a/Demos/Device/ClassDriver/Joystick/Joystick.c +++ b/Demos/Device/ClassDriver/Joystick/Joystick.c @@ -136,7 +136,7 @@ void EVENT_USB_Device_StartOfFrame(void) * \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent */ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, - void* ReportData, uint16_t* ReportSize) + const uint8_t ReportType, void* ReportData, uint16_t* ReportSize) { USB_JoystickReport_Data_t* JoystickReport = (USB_JoystickReport_Data_t*)ReportData; diff --git a/Demos/Device/ClassDriver/Joystick/Joystick.h b/Demos/Device/ClassDriver/Joystick/Joystick.h index d25ccc139f..c87c1c6eda 100644 --- a/Demos/Device/ClassDriver/Joystick/Joystick.h +++ b/Demos/Device/ClassDriver/Joystick/Joystick.h @@ -85,7 +85,7 @@ void EVENT_USB_Device_StartOfFrame(void); bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, - void* ReportData, uint16_t* ReportSize); + const uint8_t ReportType, void* ReportData, uint16_t* ReportSize); void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID, const void* ReportData, const uint16_t ReportSize); diff --git a/Demos/Device/ClassDriver/Keyboard/Keyboard.c b/Demos/Device/ClassDriver/Keyboard/Keyboard.c index 002d24ac96..5ba15cdd9a 100644 --- a/Demos/Device/ClassDriver/Keyboard/Keyboard.c +++ b/Demos/Device/ClassDriver/Keyboard/Keyboard.c @@ -137,7 +137,7 @@ void EVENT_USB_Device_StartOfFrame(void) * \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent */ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, - void* ReportData, uint16_t* ReportSize) + const uint8_t ReportType, void* ReportData, uint16_t* ReportSize) { USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData; diff --git a/Demos/Device/ClassDriver/Keyboard/Keyboard.h b/Demos/Device/ClassDriver/Keyboard/Keyboard.h index c6310cf9c8..098501c664 100644 --- a/Demos/Device/ClassDriver/Keyboard/Keyboard.h +++ b/Demos/Device/ClassDriver/Keyboard/Keyboard.h @@ -77,7 +77,7 @@ void EVENT_USB_Device_StartOfFrame(void); bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, - void* ReportData, uint16_t* ReportSize); + const uint8_t ReportType, void* ReportData, uint16_t* ReportSize); void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID, const void* ReportData, const uint16_t ReportSize); diff --git a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c index caa33f9075..8db7283392 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c +++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c @@ -165,7 +165,7 @@ void EVENT_USB_Device_StartOfFrame(void) * \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent */ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, - void* ReportData, uint16_t* ReportSize) + const uint8_t ReportType, void* ReportData, uint16_t* ReportSize) { uint8_t JoyStatus_LCL = Joystick_GetStatus(); uint8_t ButtonStatus_LCL = Buttons_GetStatus(); diff --git a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h index a9368a4dec..8c73521b4a 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h +++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h @@ -71,7 +71,7 @@ void EVENT_USB_Device_StartOfFrame(void); bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, - void* ReportData, uint16_t* ReportSize); + const uint8_t ReportType, void* ReportData, uint16_t* ReportSize); void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID, const void* ReportData, const uint16_t ReportSize); diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c index 4e68f5c974..3d734e0e4c 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c @@ -187,7 +187,7 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK) * \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent */ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, - void* ReportData, uint16_t* ReportSize) + const uint8_t ReportType, void* ReportData, uint16_t* ReportSize) { USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData; diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h index 3ca03f1050..c82fb78363 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h @@ -91,7 +91,7 @@ bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* MSInterfaceInfo); bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, - void* ReportData, uint16_t* ReportSize); + const uint8_t ReportType, void* ReportData, uint16_t* ReportSize); void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID, const void* ReportData, const uint16_t ReportSize); diff --git a/Demos/Device/ClassDriver/Mouse/Mouse.c b/Demos/Device/ClassDriver/Mouse/Mouse.c index c29cc15efd..36ef71bf98 100644 --- a/Demos/Device/ClassDriver/Mouse/Mouse.c +++ b/Demos/Device/ClassDriver/Mouse/Mouse.c @@ -136,7 +136,7 @@ void EVENT_USB_Device_StartOfFrame(void) * \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent */ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, - void* ReportData, uint16_t* ReportSize) + const uint8_t ReportType, void* ReportData, uint16_t* ReportSize) { USB_MouseReport_Data_t* MouseReport = (USB_MouseReport_Data_t*)ReportData; diff --git a/Demos/Device/ClassDriver/Mouse/Mouse.h b/Demos/Device/ClassDriver/Mouse/Mouse.h index 635736d0f4..6ab919f25a 100644 --- a/Demos/Device/ClassDriver/Mouse/Mouse.h +++ b/Demos/Device/ClassDriver/Mouse/Mouse.h @@ -76,7 +76,7 @@ void EVENT_USB_Device_StartOfFrame(void); bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, - void* ReportData, uint16_t* ReportSize); + const uint8_t ReportType, void* ReportData, uint16_t* ReportSize); void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID, const void* ReportData, const uint16_t ReportSize); diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c b/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c index 47a191350c..532b1a1a2e 100644 --- a/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c +++ b/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c @@ -104,7 +104,7 @@ void EVENT_USB_Device_StartOfFrame(void) * \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent */ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, - void* ReportData, uint16_t* ReportSize) + const uint8_t ReportType, void* ReportData, uint16_t* ReportSize) { USB_MouseReport_Data_t* MouseReport = (USB_MouseReport_Data_t*)ReportData; diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.h b/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.h index 5fc2d84e97..37026df97a 100644 --- a/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.h +++ b/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.h @@ -43,6 +43,11 @@ extern USB_ClassInfo_HID_Device_t Mouse_HID_Device_Interface; /* Function Prototypes: */ + bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, + const uint8_t ReportType, void* ReportData, uint16_t* ReportSize); + void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID, + const void* ReportData, const uint16_t ReportSize); + void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/HostFunctions.c b/Demos/DualRole/ClassDriver/MouseHostDevice/HostFunctions.c index a503f1c7c1..eb0252ac77 100644 --- a/Demos/DualRole/ClassDriver/MouseHostDevice/HostFunctions.c +++ b/Demos/DualRole/ClassDriver/MouseHostDevice/HostFunctions.c @@ -50,7 +50,7 @@ USB_ClassInfo_HID_Host_t Mouse_HID_Host_Interface = .HIDInterfaceProtocol = HID_BOOT_MOUSE_PROTOCOL, }, }; - + /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and * starts the library USB task to begin the enumeration and USB management process. diff --git a/LUFA/Drivers/USB/Class/Device/HID.c b/LUFA/Drivers/USB/Class/Device/HID.c index a9f1c9c817..94cbf5d3f9 100644 --- a/LUFA/Drivers/USB/Class/Device/HID.c +++ b/LUFA/Drivers/USB/Class/Device/HID.c @@ -50,10 +50,11 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter uint16_t ReportINSize = 0; uint8_t ReportID = (USB_ControlRequest.wValue & 0xFF); + uint8_t ReportType = (USB_ControlRequest.wValue >> 8) - 1; memset(HIDInterfaceInfo->Config.PrevReportINBuffer, 0, HIDInterfaceInfo->Config.PrevReportINBufferSize); - CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, + CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, ReportType, HIDInterfaceInfo->Config.PrevReportINBuffer, &ReportINSize); Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); @@ -158,7 +159,8 @@ void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) memset(ReportINData, 0, sizeof(ReportINData)); - bool ForceSend = CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, ReportINData, &ReportINSize); + bool ForceSend = CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, REPORT_ITEM_TYPE_In, + ReportINData, &ReportINSize); bool StatesChanged = false; bool IdlePeriodElapsed = (HIDInterfaceInfo->State.IdleCount && !(HIDInterfaceInfo->State.IdleMSRemaining)); diff --git a/LUFA/Drivers/USB/Class/Device/HID.h b/LUFA/Drivers/USB/Class/Device/HID.h index 25348f6406..d51327c39c 100644 --- a/LUFA/Drivers/USB/Class/Device/HID.h +++ b/LUFA/Drivers/USB/Class/Device/HID.h @@ -147,15 +147,16 @@ * \param[in,out] ReportID If preset to a non-zero value, this is the report ID being requested by the host. If zero, this should * be set to the report ID of the generated HID input report (if any). If multiple reports are not sent via the * given HID interface, this parameter should be ignored. - * \param[out] ReportData Pointer to a buffer where the generated HID report should be stored. + * \param[in] ReportType Type of HID report to generate, either \ref REPORT_ITEM_TYPE_In or \ref REPORT_ITEM_TYPE_Feature + * \param[out] ReportData Pointer to a buffer where the generated HID report should be stored * \param[out] ReportSize Number of bytes in the generated input report, or zero if no report is to be sent * * \return Boolean true to force the sending of the report even if it is identical to the previous report and still within * the idle period (useful for devices which report relative movement), false otherwise */ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, - void* ReportData, uint16_t* ReportSize) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2) - ATTR_NON_NULL_PTR_ARG(3) ATTR_NON_NULL_PTR_ARG(4); + const uint8_t ReportType, void* ReportData, uint16_t* ReportSize) ATTR_NON_NULL_PTR_ARG(1) + ATTR_NON_NULL_PTR_ARG(2) ATTR_NON_NULL_PTR_ARG(4) ATTR_NON_NULL_PTR_ARG(5); /** HID class driver callback for the user processing of a received HID OUT report. This callback may fire in response to * either HID class control requests from the host, or by the normal HID endpoint polling procedure. Inside this callback diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt index a69eb9a1d9..0aa3dafaad 100644 --- a/LUFA/ManPages/ChangeLog.txt +++ b/LUFA/ManPages/ChangeLog.txt @@ -18,6 +18,8 @@ * - The SCSI_Request_Sense_Response_t and SCSI_Inquiry_Response_t type defines are now part of the Mass Storage Class * driver common defines, rather than being defined in the Host mode Class driver section only * - The USB_MODE_HOST token is now defined even when host mode is not available + * - The CALLBACK_HID_Device_CreateHIDReport() HID Device Class driver callback now has a new ReportType parameter to + * indicate the report type to generate * * Fixed: * - Added missing CDC_Host_CreateBlockingStream() function code to the CDC Host Class driver diff --git a/LUFA/ManPages/MigrationInformation.txt b/LUFA/ManPages/MigrationInformation.txt index 89bba9697d..aad002ddeb 100644 --- a/LUFA/ManPages/MigrationInformation.txt +++ b/LUFA/ManPages/MigrationInformation.txt @@ -12,7 +12,9 @@ * * \section Sec_MigrationXXXXXX Migrating from 091122 to XXXXXX * - * There is no migration information for this version. + * Device Mode + * - The CALLBACK_HID_Device_CreateHIDReport() HID Device Class driver callback now has a new ReportType parameter to + * indicate the report type to generate. Existing applications may simply add and ignore this additional parameter. * * \section Sec_Migration091122 Migrating from 090924 to 091122 * diff --git a/Projects/Magstripe/Magstripe.c b/Projects/Magstripe/Magstripe.c index 69f17c7593..b30590f658 100644 --- a/Projects/Magstripe/Magstripe.c +++ b/Projects/Magstripe/Magstripe.c @@ -169,7 +169,7 @@ void EVENT_USB_Device_StartOfFrame(void) * \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent */ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, - void* ReportData, uint16_t* ReportSize) + const uint8_t ReportType, void* ReportData, uint16_t* ReportSize) { USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData; diff --git a/Projects/Magstripe/Magstripe.h b/Projects/Magstripe/Magstripe.h index 36e4d7091a..cd1fd9c30a 100644 --- a/Projects/Magstripe/Magstripe.h +++ b/Projects/Magstripe/Magstripe.h @@ -75,7 +75,7 @@ void EVENT_USB_Device_StartOfFrame(void); bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, - void* ReportData, uint16_t* ReportSize); + const uint8_t ReportType, void* ReportData, uint16_t* ReportSize); void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID, const void* ReportData, const uint16_t ReportSize);