From 05ac59d0eeb956adc316d89ee06ca13bd3c11aac Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sun, 9 May 2010 06:01:01 +0000 Subject: [PATCH] Add new ReportType parameter to the HID class driver device callback and host report sending routines. Renamed internal Host mode Class driver descriptor comparator callback routines so that they all start with a uniform DCOMP_{Class Abbreviation}_ prefix. --- .../ClassDriver/GenericHID/GenericHID.c | 5 ++-- .../ClassDriver/GenericHID/GenericHID.h | 2 +- Demos/Device/ClassDriver/Joystick/Joystick.c | 5 ++-- Demos/Device/ClassDriver/Joystick/Joystick.h | 2 +- Demos/Device/ClassDriver/Keyboard/Keyboard.c | 5 ++-- Demos/Device/ClassDriver/Keyboard/Keyboard.h | 2 +- .../ClassDriver/KeyboardMouse/KeyboardMouse.c | 5 ++-- .../ClassDriver/KeyboardMouse/KeyboardMouse.h | 2 +- .../MassStorageKeyboard/MassStorageKeyboard.c | 5 ++-- .../MassStorageKeyboard/MassStorageKeyboard.h | 2 +- Demos/Device/ClassDriver/Mouse/Mouse.c | 5 ++-- Demos/Device/ClassDriver/Mouse/Mouse.h | 2 +- .../VirtualSerialMouse/VirtualSerialMouse.c | 5 ++-- .../VirtualSerialMouse/VirtualSerialMouse.h | 2 +- .../MouseHostDevice/DeviceFunctions.c | 5 ++-- .../MouseHostDevice/DeviceFunctions.h | 2 +- LUFA/Drivers/USB/Class/Device/HID.c | 28 +++++++++---------- LUFA/Drivers/USB/Class/Device/HID.h | 5 ++-- LUFA/Drivers/USB/Class/Host/CDC.c | 16 +++++------ LUFA/Drivers/USB/Class/Host/CDC.h | 6 ++-- LUFA/Drivers/USB/Class/Host/HID.c | 20 ++++++------- LUFA/Drivers/USB/Class/Host/HID.h | 17 +++++------ LUFA/Drivers/USB/Class/Host/MIDI.c | 8 +++--- LUFA/Drivers/USB/Class/Host/MIDI.h | 4 +-- LUFA/Drivers/USB/Class/Host/MassStorage.c | 8 +++--- LUFA/Drivers/USB/Class/Host/MassStorage.h | 4 +-- LUFA/Drivers/USB/Class/Host/Printer.c | 8 +++--- LUFA/Drivers/USB/Class/Host/Printer.h | 4 +-- LUFA/Drivers/USB/Class/Host/RNDIS.c | 16 +++++------ LUFA/Drivers/USB/Class/Host/RNDIS.h | 6 ++-- LUFA/Drivers/USB/Class/Host/StillImage.c | 8 +++--- LUFA/Drivers/USB/Class/Host/StillImage.h | 4 +-- LUFA/ManPages/ChangeLog.txt | 4 +++ LUFA/ManPages/MigrationInformation.txt | 5 ++++ Projects/Magstripe/Magstripe.c | 3 +- Projects/Magstripe/Magstripe.h | 2 +- Projects/RelayBoard/RelayBoard.c | 7 ----- .../TemperatureDataLogger/TempDataLogger.c | 3 +- .../TemperatureDataLogger/TempDataLogger.h | 2 +- README.txt | 2 +- 40 files changed, 130 insertions(+), 116 deletions(-) diff --git a/Demos/Device/ClassDriver/GenericHID/GenericHID.c b/Demos/Device/ClassDriver/GenericHID/GenericHID.c index 0efcd569da..e5de1870f1 100644 --- a/Demos/Device/ClassDriver/GenericHID/GenericHID.c +++ b/Demos/Device/ClassDriver/GenericHID/GenericHID.c @@ -158,12 +158,13 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn /** HID class driver callback function for the processing of HID reports from the host. * * \param[in] HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced - * \param[in] ReportID Report ID of the received report from the host + * \param[in] ReportID Report ID of the received report from the host + * \param[in] ReportType The type of report that the host has sent, either REPORT_ITEM_TYPE_Out or REPORT_ITEM_TYPE_Feature * \param[in] ReportData Pointer to a buffer where the created report has been stored * \param[in] ReportSize Size in bytes of the received HID report */ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID, - const void* ReportData, const uint16_t ReportSize) + const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize) { HIDReportEcho.ReportID = ReportID; HIDReportEcho.ReportSize = ReportSize; diff --git a/Demos/Device/ClassDriver/GenericHID/GenericHID.h b/Demos/Device/ClassDriver/GenericHID/GenericHID.h index 052ba0d510..3724b31304 100644 --- a/Demos/Device/ClassDriver/GenericHID/GenericHID.h +++ b/Demos/Device/ClassDriver/GenericHID/GenericHID.h @@ -75,6 +75,6 @@ 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); + const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize); #endif diff --git a/Demos/Device/ClassDriver/Joystick/Joystick.c b/Demos/Device/ClassDriver/Joystick/Joystick.c index bbd577d2e6..af529e0de9 100644 --- a/Demos/Device/ClassDriver/Joystick/Joystick.c +++ b/Demos/Device/ClassDriver/Joystick/Joystick.c @@ -168,12 +168,13 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn /** HID class driver callback function for the processing of HID reports from the host. * * \param[in] HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced - * \param[in] ReportID Report ID of the received report from the host + * \param[in] ReportID Report ID of the received report from the host + * \param[in] ReportType The type of report that the host has sent, either REPORT_ITEM_TYPE_Out or REPORT_ITEM_TYPE_Feature * \param[in] ReportData Pointer to a buffer where the created report has been stored * \param[in] ReportSize Size in bytes of the received HID report */ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID, - const void* ReportData, const uint16_t ReportSize) + const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize) { // Unused (but mandatory for the HID class driver) in this demo, since there are no Host->Device reports } diff --git a/Demos/Device/ClassDriver/Joystick/Joystick.h b/Demos/Device/ClassDriver/Joystick/Joystick.h index 20428b25f5..285febbd6d 100644 --- a/Demos/Device/ClassDriver/Joystick/Joystick.h +++ b/Demos/Device/ClassDriver/Joystick/Joystick.h @@ -88,6 +88,6 @@ 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); + const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize); #endif diff --git a/Demos/Device/ClassDriver/Keyboard/Keyboard.c b/Demos/Device/ClassDriver/Keyboard/Keyboard.c index 0937e1c4a0..975c4d3f86 100644 --- a/Demos/Device/ClassDriver/Keyboard/Keyboard.c +++ b/Demos/Device/ClassDriver/Keyboard/Keyboard.c @@ -173,12 +173,13 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn /** HID class driver callback function for the processing of HID reports from the host. * * \param[in] HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced - * \param[in] ReportID Report ID of the received report from the host + * \param[in] ReportID Report ID of the received report from the host + * \param[in] ReportType The type of report that the host has sent, either REPORT_ITEM_TYPE_Out or REPORT_ITEM_TYPE_Feature * \param[in] ReportData Pointer to a buffer where the created report has been stored * \param[in] ReportSize Size in bytes of the received HID report */ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID, - const void* ReportData, const uint16_t ReportSize) + const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize) { uint8_t LEDMask = LEDS_NO_LEDS; uint8_t* LEDReport = (uint8_t*)ReportData; diff --git a/Demos/Device/ClassDriver/Keyboard/Keyboard.h b/Demos/Device/ClassDriver/Keyboard/Keyboard.h index 76c662163c..a415d51b16 100644 --- a/Demos/Device/ClassDriver/Keyboard/Keyboard.h +++ b/Demos/Device/ClassDriver/Keyboard/Keyboard.h @@ -79,6 +79,6 @@ 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); + const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize); #endif diff --git a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c index 9e0da93893..1a7d9cf060 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c +++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c @@ -227,12 +227,13 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn /** HID class driver callback function for the processing of HID reports from the host. * * \param[in] HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced - * \param[in] ReportID Report ID of the received report from the host + * \param[in] ReportID Report ID of the received report from the host + * \param[in] ReportType The type of report that the host has sent, either REPORT_ITEM_TYPE_Out or REPORT_ITEM_TYPE_Feature * \param[in] ReportData Pointer to a buffer where the created report has been stored * \param[in] ReportSize Size in bytes of the received HID report */ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID, - const void* ReportData, const uint16_t ReportSize) + const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize) { if (HIDInterfaceInfo == &Keyboard_HID_Interface) { diff --git a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h index bb7e1eeed5..fff7c40de1 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h +++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h @@ -74,6 +74,6 @@ 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); + const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize); #endif diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c index 780b2b2736..717bfd5ae5 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c @@ -218,12 +218,13 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn /** HID class driver callback function for the processing of HID reports from the host. * * \param[in] HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced - * \param[in] ReportID Report ID of the received report from the host + * \param[in] ReportID Report ID of the received report from the host + * \param[in] ReportType The type of report that the host has sent, either REPORT_ITEM_TYPE_Out or REPORT_ITEM_TYPE_Feature * \param[in] ReportData Pointer to a buffer where the created report has been stored * \param[in] ReportSize Size in bytes of the received HID report */ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID, - const void* ReportData, const uint16_t ReportSize) + const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize) { uint8_t LEDMask = LEDS_NO_LEDS; uint8_t* LEDReport = (uint8_t*)ReportData; diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h index 4c1ce96061..02ae98ec9f 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h @@ -95,7 +95,7 @@ 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); + const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize); #endif diff --git a/Demos/Device/ClassDriver/Mouse/Mouse.c b/Demos/Device/ClassDriver/Mouse/Mouse.c index 2335c11b94..a9c168e769 100644 --- a/Demos/Device/ClassDriver/Mouse/Mouse.c +++ b/Demos/Device/ClassDriver/Mouse/Mouse.c @@ -168,12 +168,13 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn /** HID class driver callback function for the processing of HID reports from the host. * * \param[in] HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced - * \param[in] ReportID Report ID of the received report from the host + * \param[in] ReportID Report ID of the received report from the host + * \param[in] ReportType The type of report that the host has sent, either REPORT_ITEM_TYPE_Out or REPORT_ITEM_TYPE_Feature * \param[in] ReportData Pointer to a buffer where the created report has been stored * \param[in] ReportSize Size in bytes of the received HID report */ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID, - const void* ReportData, const uint16_t ReportSize) + const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize) { // Unused (but mandatory for the HID class driver) in this demo, since there are no Host->Device reports } diff --git a/Demos/Device/ClassDriver/Mouse/Mouse.h b/Demos/Device/ClassDriver/Mouse/Mouse.h index 3ce9d046d2..74eef97ca9 100644 --- a/Demos/Device/ClassDriver/Mouse/Mouse.h +++ b/Demos/Device/ClassDriver/Mouse/Mouse.h @@ -79,6 +79,6 @@ 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); + const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize); #endif diff --git a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c index b8884fe401..3be6f4c85f 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c +++ b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c @@ -230,12 +230,13 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn /** HID class driver callback function for the processing of HID reports from the host. * * \param[in] HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced - * \param[in] ReportID Report ID of the received report from the host + * \param[in] ReportID Report ID of the received report from the host + * \param[in] ReportType The type of report that the host has sent, either REPORT_ITEM_TYPE_Out or REPORT_ITEM_TYPE_Feature * \param[in] ReportData Pointer to a buffer where the created report has been stored * \param[in] ReportSize Size in bytes of the received HID report */ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID, - const void* ReportData, const uint16_t ReportSize) + const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize) { // Unused (but mandatory for the HID class driver) in this demo, since there are no Host->Device reports } diff --git a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.h b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.h index a1371137cb..fae00f96f0 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.h +++ b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.h @@ -79,5 +79,5 @@ 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); + const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize); #endif diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c b/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c index e1a158dc36..e566cf89bd 100644 --- a/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c +++ b/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c @@ -135,12 +135,13 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn /** HID class driver callback function for the processing of HID reports from the host. * * \param[in] HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced - * \param[in] ReportID Report ID of the received report from the host + * \param[in] ReportID Report ID of the received report from the host + * \param[in] ReportType The type of report that the host has sent, either REPORT_ITEM_TYPE_Out or REPORT_ITEM_TYPE_Feature * \param[in] ReportData Pointer to a buffer where the created report has been stored * \param[in] ReportSize Size in bytes of the received HID report */ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID, - const void* ReportData, const uint16_t ReportSize) + const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize) { // Unused (but mandatory for the HID class driver) in this demo, since there are no Host->Device reports } \ No newline at end of file diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.h b/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.h index b673f8a4f5..db9cd76ce5 100644 --- a/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.h +++ b/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.h @@ -46,7 +46,7 @@ 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); + const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize); void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); diff --git a/LUFA/Drivers/USB/Class/Device/HID.c b/LUFA/Drivers/USB/Class/Device/HID.c index 88bb60993c..bc796464dd 100644 --- a/LUFA/Drivers/USB/Class/Device/HID.c +++ b/LUFA/Drivers/USB/Class/Device/HID.c @@ -50,21 +50,20 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter { Endpoint_ClearSETUP(); - uint16_t ReportINSize = 0; - uint8_t ReportID = (USB_ControlRequest.wValue & 0xFF); - uint8_t ReportType = (USB_ControlRequest.wValue >> 8) - 1; - uint8_t ReportINData[HIDInterfaceInfo->Config.PrevReportINBufferSize]; + uint16_t ReportSize = 0; + uint8_t ReportID = (USB_ControlRequest.wValue & 0xFF); + uint8_t ReportType = (USB_ControlRequest.wValue >> 8) - 1; + uint8_t ReportData[HIDInterfaceInfo->Config.PrevReportINBufferSize]; - memset(ReportINData, 0, sizeof(ReportINData)); + memset(ReportData, 0, sizeof(ReportData)); - CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, ReportType, - HIDInterfaceInfo->Config.PrevReportINBuffer, &ReportINSize); + CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, ReportType, ReportData, &ReportSize); if (HIDInterfaceInfo->Config.PrevReportINBuffer != NULL) - memcpy(HIDInterfaceInfo->Config.PrevReportINBuffer, ReportINData, HIDInterfaceInfo->Config.PrevReportINBufferSize); + memcpy(HIDInterfaceInfo->Config.PrevReportINBuffer, ReportData, HIDInterfaceInfo->Config.PrevReportINBufferSize); Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); - Endpoint_Write_Control_Stream_LE(HIDInterfaceInfo->Config.PrevReportINBuffer, ReportINSize); + Endpoint_Write_Control_Stream_LE(HIDInterfaceInfo->Config.PrevReportINBuffer, ReportSize); Endpoint_ClearOUT(); } @@ -74,12 +73,13 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter { Endpoint_ClearSETUP(); - uint16_t ReportOUTSize = USB_ControlRequest.wLength; - uint8_t ReportOUTData[ReportOUTSize]; - uint8_t ReportID = (USB_ControlRequest.wValue & 0xFF); + uint16_t ReportSize = USB_ControlRequest.wLength; + uint8_t ReportID = (USB_ControlRequest.wValue & 0xFF); + uint8_t ReportType = (USB_ControlRequest.wValue >> 8) - 1; + uint8_t ReportData[ReportSize]; - Endpoint_Read_Control_Stream_LE(ReportOUTData, ReportOUTSize); - CALLBACK_HID_Device_ProcessHIDReport(HIDInterfaceInfo, ReportID, ReportOUTData, ReportOUTSize); + Endpoint_Read_Control_Stream_LE(ReportData, ReportSize); + CALLBACK_HID_Device_ProcessHIDReport(HIDInterfaceInfo, ReportID, ReportType, ReportData, ReportSize); Endpoint_ClearIN(); } diff --git a/LUFA/Drivers/USB/Class/Device/HID.h b/LUFA/Drivers/USB/Class/Device/HID.h index ac6ee4cb7b..9e42843d43 100644 --- a/LUFA/Drivers/USB/Class/Device/HID.h +++ b/LUFA/Drivers/USB/Class/Device/HID.h @@ -174,12 +174,13 @@ * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state * \param[in] ReportID Report ID of the received output report. If multiple reports are not received via the given HID * interface, this parameter should be ignored. + * \param[in] ReportType Type of received HID report, either \ref REPORT_ITEM_TYPE_Out or \ref REPORT_ITEM_TYPE_Feature * \param[in] ReportData Pointer to a buffer where the received HID report is stored. * \param[in] ReportSize Size in bytes of the received report from the host. */ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID, - const void* ReportData, const uint16_t ReportSize) ATTR_NON_NULL_PTR_ARG(1) - ATTR_NON_NULL_PTR_ARG(3); + const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize) ATTR_NON_NULL_PTR_ARG(1) + ATTR_NON_NULL_PTR_ARG(4); /* Inline Functions: */ /** Indicates that a millisecond of idle time has elapsed on the given HID interface, and the interface's idle count should be diff --git a/LUFA/Drivers/USB/Class/Host/CDC.c b/LUFA/Drivers/USB/Class/Host/CDC.c index 3d158fb75e..5679a7c2ab 100644 --- a/LUFA/Drivers/USB/Class/Host/CDC.c +++ b/LUFA/Drivers/USB/Class/Host/CDC.c @@ -47,7 +47,7 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo return CDC_ENUMERROR_InvalidConfigDescriptor; if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DComp_CDC_Host_NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found) + DCOMP_CDC_Host_NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found) { return CDC_ENUMERROR_NoCDCInterfaceFound; } @@ -57,12 +57,12 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo while (FoundEndpoints != (CDC_FOUND_NOTIFICATION_IN | CDC_FOUND_DATAPIPE_IN | CDC_FOUND_DATAPIPE_OUT)) { if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DComp_CDC_Host_NextCDCInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) + DCOMP_CDC_Host_NextCDCInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) { if (FoundEndpoints & CDC_FOUND_NOTIFICATION_IN) { if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DComp_CDC_Host_NextCDCDataInterface) != DESCRIPTOR_SEARCH_COMP_Found) + DCOMP_CDC_Host_NextCDCDataInterface) != DESCRIPTOR_SEARCH_COMP_Found) { return CDC_ENUMERROR_NoCDCInterfaceFound; } @@ -79,14 +79,14 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo Pipe_DisablePipe(); if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DComp_CDC_Host_NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found) + DCOMP_CDC_Host_NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found) { return CDC_ENUMERROR_NoCDCInterfaceFound; } } if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DComp_CDC_Host_NextCDCInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) + DCOMP_CDC_Host_NextCDCInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) { return CDC_ENUMERROR_EndpointsNotFound; } @@ -139,7 +139,7 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo return CDC_ENUMERROR_NoError; } -static uint8_t DComp_CDC_Host_NextCDCControlInterface(void* const CurrentDescriptor) +static uint8_t DCOMP_CDC_Host_NextCDCControlInterface(void* const CurrentDescriptor) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface) { @@ -157,7 +157,7 @@ static uint8_t DComp_CDC_Host_NextCDCControlInterface(void* const CurrentDescrip return DESCRIPTOR_SEARCH_NotFound; } -static uint8_t DComp_CDC_Host_NextCDCDataInterface(void* const CurrentDescriptor) +static uint8_t DCOMP_CDC_Host_NextCDCDataInterface(void* const CurrentDescriptor) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface) { @@ -175,7 +175,7 @@ static uint8_t DComp_CDC_Host_NextCDCDataInterface(void* const CurrentDescriptor return DESCRIPTOR_SEARCH_NotFound; } -static uint8_t DComp_CDC_Host_NextCDCInterfaceEndpoint(void* const CurrentDescriptor) +static uint8_t DCOMP_CDC_Host_NextCDCInterfaceEndpoint(void* const CurrentDescriptor) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint) { diff --git a/LUFA/Drivers/USB/Class/Host/CDC.h b/LUFA/Drivers/USB/Class/Host/CDC.h index 9c59ad3433..2ccc880542 100644 --- a/LUFA/Drivers/USB/Class/Host/CDC.h +++ b/LUFA/Drivers/USB/Class/Host/CDC.h @@ -320,9 +320,9 @@ void CDC_Host_Event_Stub(void); void EVENT_CDC_Host_ControLineStateChanged(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_WEAK ATTR_NON_NULL_PTR_ARG(1) ATTR_ALIAS(CDC_Host_Event_Stub); - static uint8_t DComp_CDC_Host_NextCDCControlInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); - static uint8_t DComp_CDC_Host_NextCDCDataInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); - static uint8_t DComp_CDC_Host_NextCDCInterfaceEndpoint(void* const CurrentDescriptor); + static uint8_t DCOMP_CDC_Host_NextCDCControlInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); + static uint8_t DCOMP_CDC_Host_NextCDCDataInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); + static uint8_t DCOMP_CDC_Host_NextCDCInterfaceEndpoint(void* const CurrentDescriptor); #endif #endif diff --git a/LUFA/Drivers/USB/Class/Host/HID.c b/LUFA/Drivers/USB/Class/Host/HID.c index f7292d742c..9415c86037 100644 --- a/LUFA/Drivers/USB/Class/Host/HID.c +++ b/LUFA/Drivers/USB/Class/Host/HID.c @@ -51,7 +51,7 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo do { if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DComp_HID_Host_NextHIDInterface) != DESCRIPTOR_SEARCH_COMP_Found) + DCOMP_HID_Host_NextHIDInterface) != DESCRIPTOR_SEARCH_COMP_Found) { return HID_ENUMERROR_NoHIDInterfaceFound; } @@ -63,7 +63,7 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo HIDInterfaceInfo->State.InterfaceNumber = CurrentHIDInterface->InterfaceNumber; HIDInterfaceInfo->State.SupportsBootProtocol = (CurrentHIDInterface->SubClass != HID_NON_BOOT_PROTOCOL); - if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, DComp_NextHID) != DESCRIPTOR_SEARCH_COMP_Found) + if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, DCOMP_HID_NextHID) != DESCRIPTOR_SEARCH_COMP_Found) { return HID_ENUMERROR_NoHIDDescriptorFound; } @@ -73,7 +73,7 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo while (FoundEndpoints != (HID_FOUND_DATAPIPE_IN | HID_FOUND_DATAPIPE_OUT)) { if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DComp_HID_Host_NextHIDInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) + DCOMP_HID_Host_NextHIDInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) { if (FoundEndpoints & HID_FOUND_DATAPIPE_IN) break; @@ -110,7 +110,7 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo return HID_ENUMERROR_NoError; } -static uint8_t DComp_HID_Host_NextHIDInterface(void* const CurrentDescriptor) +static uint8_t DCOMP_HID_Host_NextHIDInterface(void* const CurrentDescriptor) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface) { @@ -124,7 +124,7 @@ static uint8_t DComp_HID_Host_NextHIDInterface(void* const CurrentDescriptor) return DESCRIPTOR_SEARCH_NotFound; } -static uint8_t DComp_NextHID(void* const CurrentDescriptor) +static uint8_t DCOMP_HID_NextHID(void* const CurrentDescriptor) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_HID) return DESCRIPTOR_SEARCH_Found; @@ -134,7 +134,7 @@ static uint8_t DComp_NextHID(void* const CurrentDescriptor) return DESCRIPTOR_SEARCH_NotFound; } -static uint8_t DComp_HID_Host_NextHIDInterfaceEndpoint(void* const CurrentDescriptor) +static uint8_t DCOMP_HID_Host_NextHIDInterfaceEndpoint(void* const CurrentDescriptor) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint) { @@ -215,13 +215,13 @@ uint8_t HID_Host_SendReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo #if !defined(HID_HOST_BOOT_PROTOCOL_ONLY) const uint8_t ReportID, #endif - void* Buffer, const uint16_t ReportSize) + const uint8_t ReportType, void* Buffer, const uint16_t ReportSize) { #if !defined(HID_HOST_BOOT_PROTOCOL_ONLY) if ((USB_HostState != HOST_STATE_Configured) || !(HIDInterfaceInfo->State.IsActive)) return false; - if (HIDInterfaceInfo->State.DeviceUsesOUTPipe) + if (HIDInterfaceInfo->State.DeviceUsesOUTPipe && (ReportType == REPORT_ITEM_TYPE_Out)) { uint8_t ErrorCode; @@ -247,9 +247,9 @@ uint8_t HID_Host_SendReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), .bRequest = REQ_SetReport, #if !defined(HID_HOST_BOOT_PROTOCOL_ONLY) - .wValue = ((REPORT_ITEM_TYPE_Out + 1) << 8) | ReportID, + .wValue = ((ReportType + 1) << 8) | ReportID, #else - .wValue = ((REPORT_ITEM_TYPE_Out + 1) << 8), + .wValue = ((ReportType + 1) << 8), #endif .wIndex = HIDInterfaceInfo->State.InterfaceNumber, .wLength = ReportSize, diff --git a/LUFA/Drivers/USB/Class/Host/HID.h b/LUFA/Drivers/USB/Class/Host/HID.h index 1291bd2cfb..7aabd7c659 100644 --- a/LUFA/Drivers/USB/Class/Host/HID.h +++ b/LUFA/Drivers/USB/Class/Host/HID.h @@ -201,8 +201,8 @@ void* Buffer) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); #endif - /** Sends an OUT report to the currently attached HID device, using the device's OUT pipe if available or the device's - * Control pipe if not. + /** Sends an OUT or FEATURE report to the currently attached HID device, using the device's OUT pipe if available, + * or the device's Control pipe if not. * * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * call will fail. @@ -213,6 +213,7 @@ * * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state * \param[in] ReportID Report ID of the report to send to the device, or 0 if the device does not use report IDs + * \param[in] ReportType Type of report to issue to the device, either \ref REPORT_ITEM_TYPE_Out or \ref REPORT_ITEM_TYPE_Feature * \param[in] Buffer Buffer containing the report to send to the attached device * \param[in] ReportSize Report size in bytes to send to the attached device * @@ -223,11 +224,11 @@ #if !defined(HID_HOST_BOOT_PROTOCOL_ONLY) const uint8_t ReportID, #endif - void* Buffer, const uint16_t ReportSize) ATTR_NON_NULL_PTR_ARG(1) + const uint8_t ReportType, void* Buffer, const uint16_t ReportSize) ATTR_NON_NULL_PTR_ARG(1) #if !defined(HID_HOST_BOOT_PROTOCOL_ONLY) - ATTR_NON_NULL_PTR_ARG(3); + ATTR_NON_NULL_PTR_ARG(4); #else - ATTR_NON_NULL_PTR_ARG(2); + ATTR_NON_NULL_PTR_ARG(3); #endif /** Determines if a HID IN report has been received from the attached device on the data IN pipe. @@ -296,9 +297,9 @@ /* Function Prototypes: */ #if defined(__INCLUDE_FROM_HID_CLASS_HOST_C) - static uint8_t DComp_HID_Host_NextHIDInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); - static uint8_t DComp_NextHID(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); - static uint8_t DComp_HID_Host_NextHIDInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); + static uint8_t DCOMP_HID_Host_NextHIDInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); + static uint8_t DCOMP_HID_NextHID(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); + static uint8_t DCOMP_HID_Host_NextHIDInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); #endif #endif diff --git a/LUFA/Drivers/USB/Class/Host/MIDI.c b/LUFA/Drivers/USB/Class/Host/MIDI.c index f5505959a3..50b7b3e1f5 100644 --- a/LUFA/Drivers/USB/Class/Host/MIDI.c +++ b/LUFA/Drivers/USB/Class/Host/MIDI.c @@ -47,7 +47,7 @@ uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceI return MIDI_ENUMERROR_InvalidConfigDescriptor; if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DComp_MIDI_Host_NextMIDIStreamingInterface) != DESCRIPTOR_SEARCH_COMP_Found) + DCOMP_MIDI_Host_NextMIDIStreamingInterface) != DESCRIPTOR_SEARCH_COMP_Found) { return MIDI_ENUMERROR_NoStreamingInterfaceFound; } @@ -55,7 +55,7 @@ uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceI while (FoundEndpoints != (MIDI_FOUND_DATAPIPE_IN | MIDI_FOUND_DATAPIPE_OUT)) { if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DComp_MIDI_Host_NextMIDIStreamingDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) + DCOMP_MIDI_Host_NextMIDIStreamingDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) { return MIDI_ENUMERROR_EndpointsNotFound; } @@ -86,7 +86,7 @@ uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceI return MIDI_ENUMERROR_NoError; } -static uint8_t DComp_MIDI_Host_NextMIDIStreamingInterface(void* const CurrentDescriptor) +static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingInterface(void* const CurrentDescriptor) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface) { @@ -104,7 +104,7 @@ static uint8_t DComp_MIDI_Host_NextMIDIStreamingInterface(void* const CurrentDes return DESCRIPTOR_SEARCH_NotFound; } -static uint8_t DComp_MIDI_Host_NextMIDIStreamingDataEndpoint(void* const CurrentDescriptor) +static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingDataEndpoint(void* const CurrentDescriptor) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint) { diff --git a/LUFA/Drivers/USB/Class/Host/MIDI.h b/LUFA/Drivers/USB/Class/Host/MIDI.h index dd064af194..2ff6c9be0d 100644 --- a/LUFA/Drivers/USB/Class/Host/MIDI.h +++ b/LUFA/Drivers/USB/Class/Host/MIDI.h @@ -189,8 +189,8 @@ /* Function Prototypes: */ #if defined(__INCLUDE_FROM_MIDI_CLASS_HOST_C) - static uint8_t DComp_MIDI_Host_NextMIDIStreamingInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); - static uint8_t DComp_MIDI_Host_NextMIDIStreamingDataEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); + static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); + static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingDataEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); #endif #endif diff --git a/LUFA/Drivers/USB/Class/Host/MassStorage.c b/LUFA/Drivers/USB/Class/Host/MassStorage.c index 6e84d07b8d..a96d47da9d 100644 --- a/LUFA/Drivers/USB/Class/Host/MassStorage.c +++ b/LUFA/Drivers/USB/Class/Host/MassStorage.c @@ -47,7 +47,7 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, u return MS_ENUMERROR_InvalidConfigDescriptor; if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &DeviceConfigDescriptor, - DComp_NextMSInterface) != DESCRIPTOR_SEARCH_COMP_Found) + DCOMP_MS_NextMSInterface) != DESCRIPTOR_SEARCH_COMP_Found) { return MS_ENUMERROR_NoMSInterfaceFound; } @@ -57,7 +57,7 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, u while (FoundEndpoints != (MS_FOUND_DATAPIPE_IN | MS_FOUND_DATAPIPE_OUT)) { if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &DeviceConfigDescriptor, - DComp_NextMSInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) + DCOMP_MS_NextMSInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) { return MS_ENUMERROR_EndpointsNotFound; } @@ -88,7 +88,7 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, u return MS_ENUMERROR_NoError; } -static uint8_t DComp_NextMSInterface(void* const CurrentDescriptor) +static uint8_t DCOMP_MS_NextMSInterface(void* const CurrentDescriptor) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface) { @@ -106,7 +106,7 @@ static uint8_t DComp_NextMSInterface(void* const CurrentDescriptor) return DESCRIPTOR_SEARCH_NotFound; } -static uint8_t DComp_NextMSInterfaceEndpoint(void* const CurrentDescriptor) +static uint8_t DCOMP_MS_NextMSInterfaceEndpoint(void* const CurrentDescriptor) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint) { diff --git a/LUFA/Drivers/USB/Class/Host/MassStorage.h b/LUFA/Drivers/USB/Class/Host/MassStorage.h index 992c5a0a62..e4f7415c4f 100644 --- a/LUFA/Drivers/USB/Class/Host/MassStorage.h +++ b/LUFA/Drivers/USB/Class/Host/MassStorage.h @@ -315,8 +315,8 @@ /* Function Prototypes: */ #if defined(__INCLUDE_FROM_MS_CLASS_HOST_C) - static uint8_t DComp_NextMSInterface(void* const CurrentDescriptor); - static uint8_t DComp_NextMSInterfaceEndpoint(void* const CurrentDescriptor); + static uint8_t DCOMP_MS_NextMSInterface(void* const CurrentDescriptor); + static uint8_t DCOMP_MS_NextMSInterfaceEndpoint(void* const CurrentDescriptor); static uint8_t MS_Host_SendCommand(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, MS_CommandBlockWrapper_t* const SCSICommandBlock, diff --git a/LUFA/Drivers/USB/Class/Host/Printer.c b/LUFA/Drivers/USB/Class/Host/Printer.c index e291ae3989..e535b46ab7 100644 --- a/LUFA/Drivers/USB/Class/Host/Printer.c +++ b/LUFA/Drivers/USB/Class/Host/Printer.c @@ -47,7 +47,7 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI return PRNT_ENUMERROR_InvalidConfigDescriptor; if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &DeviceConfigDescriptor, - DComp_NextPRNTInterface) != DESCRIPTOR_SEARCH_COMP_Found) + DCOMP_PRNT_NextPRNTInterface) != DESCRIPTOR_SEARCH_COMP_Found) { return PRNT_ENUMERROR_NoPrinterInterfaceFound; } @@ -60,7 +60,7 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI while (FoundEndpoints != (PRNT_FOUND_DATAPIPE_IN | PRNT_FOUND_DATAPIPE_OUT)) { if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &DeviceConfigDescriptor, - DComp_NextPRNTInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) + DCOMP_PRNT_NextPRNTInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) { return PRNT_ENUMERROR_EndpointsNotFound; } @@ -91,7 +91,7 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI return PRNT_ENUMERROR_NoError; } -static uint8_t DComp_NextPRNTInterface(void* CurrentDescriptor) +static uint8_t DCOMP_PRNT_NextPRNTInterface(void* CurrentDescriptor) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface) { @@ -106,7 +106,7 @@ static uint8_t DComp_NextPRNTInterface(void* CurrentDescriptor) return DESCRIPTOR_SEARCH_NotFound; } -static uint8_t DComp_NextPRNTInterfaceEndpoint(void* CurrentDescriptor) +static uint8_t DCOMP_PRNT_NextPRNTInterfaceEndpoint(void* CurrentDescriptor) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint) { diff --git a/LUFA/Drivers/USB/Class/Host/Printer.h b/LUFA/Drivers/USB/Class/Host/Printer.h index 92f1f22aed..aa650ba637 100644 --- a/LUFA/Drivers/USB/Class/Host/Printer.h +++ b/LUFA/Drivers/USB/Class/Host/Printer.h @@ -218,8 +218,8 @@ /* Function Prototypes: */ #if defined(__INCLUDE_FROM_PRINTER_CLASS_HOST_C) - static uint8_t DComp_NextPRNTInterface(void* const CurrentDescriptor); - static uint8_t DComp_NextPRNTInterfaceEndpoint(void* const CurrentDescriptor); + static uint8_t DCOMP_PRNT_NextPRNTInterface(void* const CurrentDescriptor); + static uint8_t DCOMP_PRNT_NextPRNTInterfaceEndpoint(void* const CurrentDescriptor); #endif #endif diff --git a/LUFA/Drivers/USB/Class/Host/RNDIS.c b/LUFA/Drivers/USB/Class/Host/RNDIS.c index 06175d2379..5fde1c6b46 100644 --- a/LUFA/Drivers/USB/Class/Host/RNDIS.c +++ b/LUFA/Drivers/USB/Class/Host/RNDIS.c @@ -47,7 +47,7 @@ uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfa return RNDIS_ENUMERROR_InvalidConfigDescriptor; if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DComp_RNDIS_Host_NextRNDISControlInterface) != DESCRIPTOR_SEARCH_COMP_Found) + DCOMP_RNDIS_Host_NextRNDISControlInterface) != DESCRIPTOR_SEARCH_COMP_Found) { return RNDIS_ENUMERROR_NoRNDISInterfaceFound; } @@ -57,12 +57,12 @@ uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfa while (FoundEndpoints != (RNDIS_FOUND_NOTIFICATION_IN | RNDIS_FOUND_DATAPIPE_IN | RNDIS_FOUND_DATAPIPE_OUT)) { if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DComp_RNDIS_Host_NextRNDISInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) + DCOMP_RNDIS_Host_NextRNDISInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) { if (FoundEndpoints & RNDIS_FOUND_NOTIFICATION_IN) { if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DComp_RNDIS_Host_NextRNDISDataInterface) != DESCRIPTOR_SEARCH_COMP_Found) + DCOMP_RNDIS_Host_NextRNDISDataInterface) != DESCRIPTOR_SEARCH_COMP_Found) { return RNDIS_ENUMERROR_NoRNDISInterfaceFound; } @@ -79,14 +79,14 @@ uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfa Pipe_DisablePipe(); if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DComp_RNDIS_Host_NextRNDISControlInterface) != DESCRIPTOR_SEARCH_COMP_Found) + DCOMP_RNDIS_Host_NextRNDISControlInterface) != DESCRIPTOR_SEARCH_COMP_Found) { return RNDIS_ENUMERROR_NoRNDISInterfaceFound; } } if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DComp_RNDIS_Host_NextRNDISInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) + DCOMP_RNDIS_Host_NextRNDISInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) { return RNDIS_ENUMERROR_EndpointsNotFound; } @@ -135,7 +135,7 @@ uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfa return RNDIS_ENUMERROR_NoError; } -static uint8_t DComp_RNDIS_Host_NextRNDISControlInterface(void* const CurrentDescriptor) +static uint8_t DCOMP_RNDIS_Host_NextRNDISControlInterface(void* const CurrentDescriptor) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface) { @@ -153,7 +153,7 @@ static uint8_t DComp_RNDIS_Host_NextRNDISControlInterface(void* const CurrentDes return DESCRIPTOR_SEARCH_NotFound; } -static uint8_t DComp_RNDIS_Host_NextRNDISDataInterface(void* const CurrentDescriptor) +static uint8_t DCOMP_RNDIS_Host_NextRNDISDataInterface(void* const CurrentDescriptor) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface) { @@ -171,7 +171,7 @@ static uint8_t DComp_RNDIS_Host_NextRNDISDataInterface(void* const CurrentDescri return DESCRIPTOR_SEARCH_NotFound; } -static uint8_t DComp_RNDIS_Host_NextRNDISInterfaceEndpoint(void* const CurrentDescriptor) +static uint8_t DCOMP_RNDIS_Host_NextRNDISInterfaceEndpoint(void* const CurrentDescriptor) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint) { diff --git a/LUFA/Drivers/USB/Class/Host/RNDIS.h b/LUFA/Drivers/USB/Class/Host/RNDIS.h index 7daaca8699..feddc72b39 100644 --- a/LUFA/Drivers/USB/Class/Host/RNDIS.h +++ b/LUFA/Drivers/USB/Class/Host/RNDIS.h @@ -267,9 +267,9 @@ static uint8_t RNDIS_GetEncapsulatedResponse(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - static uint8_t DComp_RNDIS_Host_NextRNDISControlInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); - static uint8_t DComp_RNDIS_Host_NextRNDISDataInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); - static uint8_t DComp_RNDIS_Host_NextRNDISInterfaceEndpoint(void* const CurrentDescriptor); + static uint8_t DCOMP_RNDIS_Host_NextRNDISControlInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); + static uint8_t DCOMP_RNDIS_Host_NextRNDISDataInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); + static uint8_t DCOMP_RNDIS_Host_NextRNDISInterfaceEndpoint(void* const CurrentDescriptor); #endif #endif diff --git a/LUFA/Drivers/USB/Class/Host/StillImage.c b/LUFA/Drivers/USB/Class/Host/StillImage.c index 4b2c6eab7f..9229803b49 100644 --- a/LUFA/Drivers/USB/Class/Host/StillImage.c +++ b/LUFA/Drivers/USB/Class/Host/StillImage.c @@ -47,7 +47,7 @@ uint8_t SImage_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInf return SI_ENUMERROR_InvalidConfigDescriptor; if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &DeviceConfigDescriptor, - DComp_SI_Host_NextSIInterface) != DESCRIPTOR_SEARCH_COMP_Found) + DCOMP_SI_Host_NextSIInterface) != DESCRIPTOR_SEARCH_COMP_Found) { return SI_ENUMERROR_NoSIInterfaceFound; } @@ -55,7 +55,7 @@ uint8_t SImage_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInf while (FoundEndpoints != (SI_FOUND_EVENTS_IN | SI_FOUND_DATAPIPE_IN | SI_FOUND_DATAPIPE_OUT)) { if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &DeviceConfigDescriptor, - DComp_SI_Host_NextSIInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) + DCOMP_SI_Host_NextSIInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) { return SI_ENUMERROR_EndpointsNotFound; } @@ -103,7 +103,7 @@ uint8_t SImage_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInf return SI_ENUMERROR_NoError; } -uint8_t DComp_SI_Host_NextSIInterface(void* const CurrentDescriptor) +uint8_t DCOMP_SI_Host_NextSIInterface(void* const CurrentDescriptor) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface) { @@ -121,7 +121,7 @@ uint8_t DComp_SI_Host_NextSIInterface(void* const CurrentDescriptor) return DESCRIPTOR_SEARCH_NotFound; } -uint8_t DComp_SI_Host_NextSIInterfaceEndpoint(void* const CurrentDescriptor) +uint8_t DCOMP_SI_Host_NextSIInterfaceEndpoint(void* const CurrentDescriptor) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint) { diff --git a/LUFA/Drivers/USB/Class/Host/StillImage.h b/LUFA/Drivers/USB/Class/Host/StillImage.h index be3357969e..02a3f3ad56 100644 --- a/LUFA/Drivers/USB/Class/Host/StillImage.h +++ b/LUFA/Drivers/USB/Class/Host/StillImage.h @@ -308,8 +308,8 @@ /* Function Prototypes: */ #if defined(__INCLUDE_FROM_SI_CLASS_HOST_C) - static uint8_t DComp_SI_Host_NextSIInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); - static uint8_t DComp_SI_Host_NextSIInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); + static uint8_t DCOMP_SI_Host_NextSIInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); + static uint8_t DCOMP_SI_Host_NextSIInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); #endif #endif diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt index 02b629609f..42f9ceacae 100644 --- a/LUFA/ManPages/ChangeLog.txt +++ b/LUFA/ManPages/ChangeLog.txt @@ -16,6 +16,10 @@ * - Added new ENDPOINT_*_BusSuspended error code to the Endpoint function, so that the stream functions early-abort if the bus * is suspended before or during a transfer * - Added new EVENT_CDC_Device_BreakSent() event and CDC_Host_SendBreak() function to the Device and Host CDC Class drivers + * - Added ReportType parameter to the HID device class driver CALLBACK_HID_Device_ProcessHIDReport() function so that FEATURE + * reports from the host to the device can be correctly processed + * - Added ReportType parameter to the HID host class driver HID_Host_SendReportByID() function so that FEATURE reports can be + * issued to the attached device * * Changed: * - AVRISP programmer project now has a more robust timeout system diff --git a/LUFA/ManPages/MigrationInformation.txt b/LUFA/ManPages/MigrationInformation.txt index 8db33b4018..0f3ddade34 100644 --- a/LUFA/ManPages/MigrationInformation.txt +++ b/LUFA/ManPages/MigrationInformation.txt @@ -23,6 +23,9 @@ * functions correctly. * - The USBInterrupt.c USB driver source file has been relocated from LUFA/Drivers/USB/HighLevel/ to LUFA/Drivers/USB/LowLevel. * Projects must update their makefile SRC values accordingly. + * - The HID Device Class driver's function signature for the CALLBACK_HID_Device_ProcessHIDReport() function has been changed, to + * allow for a new ReportType parameter. This new parameter must be added in all user applications using the Device mode HID Class + * Driver, but may be ingnored unless Host-to-Device FEATURE HID reports are used. * * Host Mode * - The \ref USB_Init() function no longer calls sei() to enable global interrupts, as the user application may need @@ -31,6 +34,8 @@ * functions correctly. * - The USBInterrupt.c USB driver source file has been relocated from LUFA/Drivers/USB/HighLevel/ to LUFA/Drivers/USB/LowLevel. * Projects must update their makefile SRC values accordingly. + * - The HID Host Class driver's function signature for the HID_Host_SendReportByID() function has been changed, to allow for a new + * ReportType parameter. Existing calls to this function should substitute REPORT_ITEM_TYPE_Out as this parameter's value. * * \section Sec_Migration100219 Migrating from 091223 to 100219 * diff --git a/Projects/Magstripe/Magstripe.c b/Projects/Magstripe/Magstripe.c index 6dbceb6e53..b16e9cd1e2 100644 --- a/Projects/Magstripe/Magstripe.c +++ b/Projects/Magstripe/Magstripe.c @@ -206,11 +206,12 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn * * \param[in] HIDInterfaceInfo Pointer to the HID interface structure for the HID interface being referenced * \param[in] ReportID Report ID of the received report from the host + * \param[in] ReportType The type of report that the host has sent, either REPORT_ITEM_TYPE_Out or REPORT_ITEM_TYPE_Feature * \param[in] ReportData Pointer to the report buffer where the received report is stored * \param[in] ReportSize Size in bytes of the report received from the host */ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID, - const void* ReportData, const uint16_t ReportSize) + const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize) { // Unused (but mandatory for the HID class driver) in this demo, since there are no Host->Device reports } diff --git a/Projects/Magstripe/Magstripe.h b/Projects/Magstripe/Magstripe.h index 08b867ec7b..18d1273792 100644 --- a/Projects/Magstripe/Magstripe.h +++ b/Projects/Magstripe/Magstripe.h @@ -78,6 +78,6 @@ 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); + const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize); #endif diff --git a/Projects/RelayBoard/RelayBoard.c b/Projects/RelayBoard/RelayBoard.c index 2f084f3e75..7bba1bad41 100644 --- a/Projects/RelayBoard/RelayBoard.c +++ b/Projects/RelayBoard/RelayBoard.c @@ -69,13 +69,6 @@ void SetupHardware(void) PORTC &= ~ALL_RELAYS; } - -/** Event handler for the library USB Configuration Changed event. */ -void EVENT_USB_Device_ConfigurationChanged(void) -{ - USB_Device_EnableSOFEvents(); -} - /** Event handler for the library USB Unhandled Control Packet event. */ void EVENT_USB_Device_UnhandledControlRequest(void) { diff --git a/Projects/TemperatureDataLogger/TempDataLogger.c b/Projects/TemperatureDataLogger/TempDataLogger.c index b5b913f370..a50903f54f 100644 --- a/Projects/TemperatureDataLogger/TempDataLogger.c +++ b/Projects/TemperatureDataLogger/TempDataLogger.c @@ -292,11 +292,12 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn * * \param[in] HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced * \param[in] ReportID Report ID of the received report from the host + * \param[in] ReportType The type of report that the host has sent, either REPORT_ITEM_TYPE_Out or REPORT_ITEM_TYPE_Feature * \param[in] ReportData Pointer to a buffer where the created report has been stored * \param[in] ReportSize Size in bytes of the received HID report */ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID, - const void* ReportData, const uint16_t ReportSize) + const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize) { Device_Report_t* ReportParams = (Device_Report_t*)ReportData; diff --git a/Projects/TemperatureDataLogger/TempDataLogger.h b/Projects/TemperatureDataLogger/TempDataLogger.h index b6a3389fe3..119ce76583 100644 --- a/Projects/TemperatureDataLogger/TempDataLogger.h +++ b/Projects/TemperatureDataLogger/TempDataLogger.h @@ -108,6 +108,6 @@ 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); + const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize); #endif diff --git a/README.txt b/README.txt index cf1f1f673a..12542325d0 100644 --- a/README.txt +++ b/README.txt @@ -28,5 +28,5 @@ the generated documentation for the library core in your chosen web browser for further Getting Started information. The documentation for the library itself (but not the documentation for the -individual demos, projects or bootloaders) is also available as a seperate +individual demos, projects or bootloaders) is also available as a separate package from the project webpage for convenience if Doxygen cannot be installed. \ No newline at end of file