diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2009-09-21 12:23:09 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2009-09-21 12:23:09 +0000 |
commit | 242303c1607fca405d9407b9fab6fb78cae676e2 (patch) | |
tree | 1163c20f5035ee4df711d1c718ef310ba89d2b53 /LUFA/Drivers/USB/Class/Host/HID.c | |
parent | 3ffa7543a05761a0c69144c9b66196b08d8f1249 (diff) | |
download | lufa-242303c1607fca405d9407b9fab6fb78cae676e2.tar.gz lufa-242303c1607fca405d9407b9fab6fb78cae676e2.tar.bz2 lufa-242303c1607fca405d9407b9fab6fb78cae676e2.zip |
Add new attributes to the HID Report Parser and HID Host Mode Class driver to keep track of the largest report the device can send for buffer allocation purposes. Change MouseHostWithParser and KeyboardHostWithParser demos to only allocate the needed number of bytes.
Diffstat (limited to 'LUFA/Drivers/USB/Class/Host/HID.c')
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/HID.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/LUFA/Drivers/USB/Class/Host/HID.c b/LUFA/Drivers/USB/Class/Host/HID.c index 87d37933e..b420a5b91 100644 --- a/LUFA/Drivers/USB/Class/Host/HID.c +++ b/LUFA/Drivers/USB/Class/Host/HID.c @@ -101,6 +101,7 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo }
}
+ HIDInterfaceInfo->State.LargestReportSize = 8;
HIDInterfaceInfo->State.IsActive = true;
return HID_ENUMERROR_NoError;
}
@@ -288,6 +289,7 @@ uint8_t USB_HID_Host_SetBootProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfac if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)
return ErrorCode;
+ HIDInterfaceInfo->State.LargestReportSize = 8;
HIDInterfaceInfo->State.UsingBootProtocol = true;
return HOST_SENDCONTROL_Successful;
@@ -339,6 +341,9 @@ uint8_t USB_HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* const HIDInterf return HID_ERROR_LOGICAL | ErrorCode;
}
+ uint8_t LargestReportSizeBits = HIDInterfaceInfo->Config.HIDParserData->LargestReportSizeBits;
+ HIDInterfaceInfo->State.LargestReportSize = (LargestReportSizeBits >> 3) + ((LargestReportSizeBits & 0x07) != 0);
+
return 0;
}
|