diff --git a/Demos/Host/ClassDriver/KeyboardHost/makefile b/Demos/Host/ClassDriver/KeyboardHost/makefile index ab4704c7f433fe1441ce1ffbde9b44ad08a00644..4a682b03715c97e19ebc202f6d173200dc4c90c9 100644 --- a/Demos/Host/ClassDriver/KeyboardHost/makefile +++ b/Demos/Host/ClassDriver/KeyboardHost/makefile @@ -137,7 +137,6 @@ SRC = $(TARGET).c \ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \ $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/HID.c \ $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HID.c \ - $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HIDParser.c \ # List C++ source files here. (C dependencies are automatically generated.) diff --git a/Demos/Host/ClassDriver/MouseHost/makefile b/Demos/Host/ClassDriver/MouseHost/makefile index 9564b74adf92db302a19321c3ecb9dd85f66262c..d37d4d53d17a38cd98e0c71d6ad6ad3034a511a4 100644 --- a/Demos/Host/ClassDriver/MouseHost/makefile +++ b/Demos/Host/ClassDriver/MouseHost/makefile @@ -137,7 +137,6 @@ SRC = $(TARGET).c \ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \ $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/HID.c \ $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HID.c \ - $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HIDParser.c \ # List C++ source files here. (C dependencies are automatically generated.) diff --git a/LUFA/Drivers/USB/Class/Common/HID.h b/LUFA/Drivers/USB/Class/Common/HID.h index 23351264368929047b849d0df8c35632e8bbf8dd..d53b12f6b99a276fa9d46653ad92e8cc3ac65d5b 100644 --- a/LUFA/Drivers/USB/Class/Common/HID.h +++ b/LUFA/Drivers/USB/Class/Common/HID.h @@ -87,6 +87,14 @@ #define HID_BOOT_KEYBOARD_PROTOCOL 0x01 /* Type Defines: */ + /** Enum for the different types of HID reports. */ + enum HID_ReportItemTypes_t + { + REPORT_ITEM_TYPE_In = 1, /**< Indicates that the item is an IN report type. */ + REPORT_ITEM_TYPE_Out = 2, /**< Indicates that the item is an OUT report type. */ + REPORT_ITEM_TYPE_Feature = 3, /**< Indicates that the item is a FEATURE report type. */ + }; + /** Type define for the HID class specific HID descriptor, to describe the HID device's specifications. Refer to the HID * specification for details on the structure elements. */ diff --git a/LUFA/Drivers/USB/Class/Device/MassStorage.c b/LUFA/Drivers/USB/Class/Device/MassStorage.c index fce8643864bb3d47d5d111885b313e16f68a22c9..43dc3f82b413d36f0dd7dd203f3358034f24287c 100644 --- a/LUFA/Drivers/USB/Class/Device/MassStorage.c +++ b/LUFA/Drivers/USB/Class/Device/MassStorage.c @@ -120,21 +120,21 @@ void MS_Device_USBTask(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) } MS_Device_ReturnCommandStatus(MSInterfaceInfo); - - if (MSInterfaceInfo->State.IsMassStoreReset) - { - Endpoint_ResetFIFO(MSInterfaceInfo->Config.DataOUTEndpointNumber); - Endpoint_ResetFIFO(MSInterfaceInfo->Config.DataINEndpointNumber); - - Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber); - Endpoint_ClearStall(); - Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber); - Endpoint_ClearStall(); - } } } - MSInterfaceInfo->State.IsMassStoreReset = false; + if (MSInterfaceInfo->State.IsMassStoreReset) + { + Endpoint_ResetFIFO(MSInterfaceInfo->Config.DataOUTEndpointNumber); + Endpoint_ResetFIFO(MSInterfaceInfo->Config.DataINEndpointNumber); + + Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber); + Endpoint_ClearStall(); + Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber); + Endpoint_ClearStall(); + + MSInterfaceInfo->State.IsMassStoreReset = false; + } } static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) @@ -165,11 +165,8 @@ static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInte StreamCallback_MS_Device_AbortOnMassStoreReset); Endpoint_ClearOUT(); - - if (MSInterfaceInfo->State.IsMassStoreReset) - return false; - - return true; + + return !(MSInterfaceInfo->State.IsMassStoreReset); } static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) diff --git a/LUFA/Drivers/USB/Class/Host/HID.c b/LUFA/Drivers/USB/Class/Host/HID.c index 7d9b3b5596dc0968d740c787e6d950d24ab134bf..a82fe537faa84f8bb9cc21926430865256818597 100644 --- a/LUFA/Drivers/USB/Class/Host/HID.c +++ b/LUFA/Drivers/USB/Class/Host/HID.c @@ -162,7 +162,7 @@ uint8_t HID_Host_ReceiveReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceI { .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), .bRequest = REQ_SetReport, - .wValue = ReportID, + .wValue = (REPORT_ITEM_TYPE_In << 8) | ReportID, .wIndex = HIDInterfaceInfo->State.InterfaceNumber, .wLength = USB_GetHIDReportSize(HIDInterfaceInfo->Config.HIDParserData, ReportID, REPORT_ITEM_TYPE_In), }; @@ -249,7 +249,7 @@ 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 = ReportID, + .wValue = (REPORT_ITEM_TYPE_Out << 8) | ReportID, #else .wValue = 0, #endif diff --git a/LUFA/Drivers/USB/Class/Host/HID.h b/LUFA/Drivers/USB/Class/Host/HID.h index 89cb3d8603ebfc3973931a20cfa41cff4fab89cb..8a70f27b37d443122da4dc2b8e5bcedc09c00019 100644 --- a/LUFA/Drivers/USB/Class/Host/HID.h +++ b/LUFA/Drivers/USB/Class/Host/HID.h @@ -158,6 +158,9 @@ /** Receives a HID IN report from the attached HID device, when a report has been received on the HID IN Data pipe. + * + * \note The destination buffer should be large enough to accomodate the largest report that the attached device + * can generate. * * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state * \param[in] Buffer Buffer to store the received report into @@ -167,7 +170,7 @@ uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, void* Buffer) ATTR_NON_NULL_PTR_ARG(1, 2); #if !defined(HID_HOST_BOOT_PROTOCOL_ONLY) - /** Received a HID IN report from the attached device, by the report ID. + /** Receives a HID IN report from the attached device, by the report ID. * * \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, this method is unavailable. * diff --git a/LUFA/Drivers/USB/Class/Host/HIDParser.h b/LUFA/Drivers/USB/Class/Host/HIDParser.h index 751e40e0e29fe538a2c9d5e4336f477b0c1da41e..d7ef272d317038ed1d8726b1f35fd3babe73c772 100644 --- a/LUFA/Drivers/USB/Class/Host/HIDParser.h +++ b/LUFA/Drivers/USB/Class/Host/HIDParser.h @@ -62,6 +62,7 @@ #include <stdbool.h> #include "HIDReportData.h" + #include "../Common/HID.h" #include "../../../../Common/Common.h" @@ -124,15 +125,7 @@ #endif /* Public Interface - May be used in end-application: */ - /* Enums: */ - /** Enum for indicating what type of report item an entry in a \ref HID_ReportInfo_t ReportItem array is */ - enum HID_ReportItemTypes_t - { - REPORT_ITEM_TYPE_In = 0, /**< Indicates that the item is an IN report type. */ - REPORT_ITEM_TYPE_Out = 1, /**< Indicates that the item is an OUT report type. */ - REPORT_ITEM_TYPE_Feature = 2, /**< Indicates that the item is a FEATURE report type. */ - }; - + /* Enums: */ /** Enum for the possible error codes in the return value of the \ref USB_ProcessHIDReport() function */ enum HID_Parse_ErrorCodes_t { diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt index 9fe00ee482d7b6949d0cdc8c23c8d32e54d5b4e9..0dd3496557a53ba4cbd41952f090f366c4f1fda2 100644 --- a/LUFA/ManPages/ChangeLog.txt +++ b/LUFA/ManPages/ChangeLog.txt @@ -46,6 +46,7 @@ * - Fixed HID device class driver not reselecting the correct endpoint once the user callback routines have been called * - Corrected HID descriptor in the Joystick Device demos - buttons should be placed outside the pointer collection * - Fixed HID report parser collection paths invalid due to misplaced semicolon in the free path item search loop + * - Fixed HID host Class driver report send/receive report broken when issued through the control pipe * * \section Sec_ChangeLog090924 Version 090924 * diff --git a/LUFA/ManPages/FutureChanges.txt b/LUFA/ManPages/FutureChanges.txt index 60afc3fa6717147441f6f32be4080f3d6cd06e7f..750fb15d741b3d3e489de5e6e2cefaea22e5e36e 100644 --- a/LUFA/ManPages/FutureChanges.txt +++ b/LUFA/ManPages/FutureChanges.txt @@ -24,7 +24,7 @@ * - Add unit testing to APIs * - Add board overviews * - Add resume interrupt support - * - Specification compliance testing for all device demos + * - Correct mishandling of error cases in Mass Storage demo * - Add RNDIS Host Class driver * - Make new demos * -# Keyboard/Mouse Dual Class Host