aboutsummaryrefslogtreecommitdiff
path: root/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c
diff options
context:
space:
mode:
authorDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2009-09-09 08:34:24 +0000
committerDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2009-09-09 08:34:24 +0000
commitbdf29641f529f8b79b1150e7580e47acbbf6a4cc (patch)
tree3d3e83df9e11a61b2710d334c82609b0f3c89b4d /Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c
parente8499094d3c9be1960e9382d7b9aa383437ff20c (diff)
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. git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@819 d5102386-fcda-11dd-9fdb-3debd5008f28
Diffstat (limited to 'Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c')
-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 69ba64b1..670cab91 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())
{