aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/Class/Device
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-05-09 06:01:01 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-05-09 06:01:01 +0000
commit05ac59d0eeb956adc316d89ee06ca13bd3c11aac (patch)
treed37e2e3f9db1e88e998fda515ac63eb98368ed30 /LUFA/Drivers/USB/Class/Device
parent071e02c6b6b4837fa9cf0b6d4c749994e02638d7 (diff)
downloadlufa-05ac59d0eeb956adc316d89ee06ca13bd3c11aac.tar.gz
lufa-05ac59d0eeb956adc316d89ee06ca13bd3c11aac.tar.bz2
lufa-05ac59d0eeb956adc316d89ee06ca13bd3c11aac.zip
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.
Diffstat (limited to 'LUFA/Drivers/USB/Class/Device')
-rw-r--r--LUFA/Drivers/USB/Class/Device/HID.c28
-rw-r--r--LUFA/Drivers/USB/Class/Device/HID.h5
2 files changed, 17 insertions, 16 deletions
diff --git a/LUFA/Drivers/USB/Class/Device/HID.c b/LUFA/Drivers/USB/Class/Device/HID.c
index 88bb60993..bc796464d 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 ac6ee4cb7..9e42843d4 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