aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Host/LowLevel/MouseHostWithParser
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-09-09 08:34:24 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-09-09 08:34:24 +0000
commit524decdeb3a0a4c7adbeb4af906556e7bc6dd77c (patch)
tree3d3e83df9e11a61b2710d334c82609b0f3c89b4d /Demos/Host/LowLevel/MouseHostWithParser
parent331929833da3e48ac9c43dce90487490d7a77af1 (diff)
downloadlufa-524decdeb3a0a4c7adbeb4af906556e7bc6dd77c.tar.gz
lufa-524decdeb3a0a4c7adbeb4af906556e7bc6dd77c.tar.bz2
lufa-524decdeb3a0a4c7adbeb4af906556e7bc6dd77c.zip
Change HID report parser so that it can calculate and record the sizes (IN, OUT and FEATURE) of each report within the device, by report ID. This will be required in host mode, so that the host can determine how many bytes of data must be read in for each report.
Add to MouseHostWithParser and KeyboardHostWithParser demos to print out the report sizes when a valid device is connected.
Diffstat (limited to 'Demos/Host/LowLevel/MouseHostWithParser')
-rw-r--r--Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c
index 69ba64b13..670cab919 100644
--- a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c
+++ b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c
@@ -181,6 +181,20 @@ void Mouse_HID_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
+
+ printf("Total Reports: %d\r\n", HIDReportInfo.TotalDeviceReports);
+
+ for (uint8_t i = 0; i < HIDReportInfo.TotalDeviceReports; i++)
+ {
+ HID_ReportSizeInfo_t* CurrReportIDInfo = &HIDReportInfo.ReportIDSizes[i];
+
+ /* Print out the byte sizes of each report within the device */
+ printf_P(PSTR(" + Report ID %d - In: %d bytes, Out: %d bytes, Feature: %d bytes\r\n"),
+ CurrReportIDInfo->ReportID,
+ ((CurrReportIDInfo->BitsIn >> 3) + (CurrReportIDInfo->BitsIn & 0x07)),
+ ((CurrReportIDInfo->BitsOut >> 3) + (CurrReportIDInfo->BitsOut & 0x07)),
+ ((CurrReportIDInfo->BitsFeature >> 3) + (CurrReportIDInfo->BitsFeature & 0x07)));
+ }
puts_P(PSTR("Mouse Enumerated.\r\n"));
@@ -190,7 +204,7 @@ void Mouse_HID_Task(void)
/* Select and unfreeze mouse data pipe */
Pipe_SelectPipe(MOUSE_DATAPIPE);
Pipe_Unfreeze();
-
+
/* Check to see if a packet has been received */
if (Pipe_IsINReceived())
{