Fixed HID host Class driver report send/receive report broken when issued through the control pipe.

Make Mass Storage device Class driver accept resets at any time, rather than just after a command block has been processed.

Remove the HID device parser from the boot protocol Keyboard/Mouse demos.
pull/1469/head
Dean Camera 15 years ago
parent 4dde844e9f
commit 8bb007f80b

@ -137,7 +137,6 @@ SRC = $(TARGET).c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/HID.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/HID.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HIDParser.c \
# List C++ source files here. (C dependencies are automatically generated.) # List C++ source files here. (C dependencies are automatically generated.)

@ -137,7 +137,6 @@ SRC = $(TARGET).c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \ $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/HID.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/HID.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HIDParser.c \
# List C++ source files here. (C dependencies are automatically generated.) # List C++ source files here. (C dependencies are automatically generated.)

@ -87,6 +87,14 @@
#define HID_BOOT_KEYBOARD_PROTOCOL 0x01 #define HID_BOOT_KEYBOARD_PROTOCOL 0x01
/* Type Defines: */ /* 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 /** 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. * specification for details on the structure elements.
*/ */

@ -120,21 +120,21 @@ void MS_Device_USBTask(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
} }
MS_Device_ReturnCommandStatus(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) static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
@ -166,10 +166,7 @@ static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInte
Endpoint_ClearOUT(); Endpoint_ClearOUT();
if (MSInterfaceInfo->State.IsMassStoreReset) return !(MSInterfaceInfo->State.IsMassStoreReset);
return false;
return true;
} }
static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)

@ -162,7 +162,7 @@ uint8_t HID_Host_ReceiveReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceI
{ {
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
.bRequest = REQ_SetReport, .bRequest = REQ_SetReport,
.wValue = ReportID, .wValue = (REPORT_ITEM_TYPE_In << 8) | ReportID,
.wIndex = HIDInterfaceInfo->State.InterfaceNumber, .wIndex = HIDInterfaceInfo->State.InterfaceNumber,
.wLength = USB_GetHIDReportSize(HIDInterfaceInfo->Config.HIDParserData, ReportID, REPORT_ITEM_TYPE_In), .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), .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
.bRequest = REQ_SetReport, .bRequest = REQ_SetReport,
#if !defined(HID_HOST_BOOT_PROTOCOL_ONLY) #if !defined(HID_HOST_BOOT_PROTOCOL_ONLY)
.wValue = ReportID, .wValue = (REPORT_ITEM_TYPE_Out << 8) | ReportID,
#else #else
.wValue = 0, .wValue = 0,
#endif #endif

@ -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. /** 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,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state
* \param[in] Buffer Buffer to store the received report into * \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); 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) #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. * \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, this method is unavailable.
* *

@ -62,6 +62,7 @@
#include <stdbool.h> #include <stdbool.h>
#include "HIDReportData.h" #include "HIDReportData.h"
#include "../Common/HID.h"
#include "../../../../Common/Common.h" #include "../../../../Common/Common.h"
@ -125,14 +126,6 @@
/* Public Interface - May be used in end-application: */ /* Public Interface - May be used in end-application: */
/* Enums: */ /* 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. */
};
/** Enum for the possible error codes in the return value of the \ref USB_ProcessHIDReport() function */ /** Enum for the possible error codes in the return value of the \ref USB_ProcessHIDReport() function */
enum HID_Parse_ErrorCodes_t enum HID_Parse_ErrorCodes_t
{ {

@ -46,6 +46,7 @@
* - Fixed HID device class driver not reselecting the correct endpoint once the user callback routines have been called * - 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 * - 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 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 * \section Sec_ChangeLog090924 Version 090924
* *

@ -24,7 +24,7 @@
* - Add unit testing to APIs * - Add unit testing to APIs
* - Add board overviews * - Add board overviews
* - Add resume interrupt support * - 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 * - Add RNDIS Host Class driver
* - Make new demos * - Make new demos
* -# Keyboard/Mouse Dual Class Host * -# Keyboard/Mouse Dual Class Host

Loading…
Cancel
Save