From 663f449c10b9a77a429aaa81066ce2b43ca6dc39 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sun, 19 Apr 2009 11:43:21 +0000 Subject: Fixed incorrect HID interface class and subclass values in the Mouse and KeyboardMouse demos (thanks to Brian Dickman). Capitolised the "Descriptor_Search" and "Descriptor_Search_Comp" prefixes of the values in the DSearch_Return_ErrorCodes_t and DSearch_Comp_Return_ErrorCodes_t enums. Minor documentation improvements. --- Demos/Device/KeyboardMouse/Descriptors.c | 6 +++--- Demos/Device/Mouse/Descriptors.c | 4 ++-- Demos/Host/CDCHost/ConfigDescriptor.c | 14 +++++++------- Demos/Host/GenericHIDHost/ConfigDescriptor.c | 10 +++++----- Demos/Host/KeyboardHost/ConfigDescriptor.c | 10 +++++----- Demos/Host/KeyboardHostWithParser/ConfigDescriptor.c | 14 +++++++------- Demos/Host/KeyboardHostWithParser/HIDReport.c | 2 +- .../Host/KeyboardHostWithParser/KeyboardHostWithParser.c | 2 +- Demos/Host/MassStorageHost/ConfigDescriptor.c | 10 +++++----- Demos/Host/MouseHost/ConfigDescriptor.c | 16 ++++++++-------- Demos/Host/MouseHostWithParser/ConfigDescriptor.c | 14 +++++++------- Demos/Host/MouseHostWithParser/HIDReport.c | 2 +- Demos/Host/MouseHostWithParser/HIDReport.h | 2 +- Demos/Host/MouseHostWithParser/MouseHostWithParser.c | 4 ++-- Demos/Host/StillImageHost/ConfigDescriptor.c | 10 +++++----- 15 files changed, 60 insertions(+), 60 deletions(-) (limited to 'Demos') diff --git a/Demos/Device/KeyboardMouse/Descriptors.c b/Demos/Device/KeyboardMouse/Descriptors.c index 7f39c6b59..39c1d4a2e 100644 --- a/Demos/Device/KeyboardMouse/Descriptors.c +++ b/Demos/Device/KeyboardMouse/Descriptors.c @@ -173,7 +173,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = Class: 0x03, SubClass: 0x01, - Protocol: 0x00, + Protocol: 0x01, InterfaceStrIndex: NO_DESCRIPTOR }, @@ -219,8 +219,8 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = TotalEndpoints: 1, Class: 0x03, - SubClass: 0x02, - Protocol: 0x00, + SubClass: 0x01, + Protocol: 0x02, InterfaceStrIndex: NO_DESCRIPTOR }, diff --git a/Demos/Device/Mouse/Descriptors.c b/Demos/Device/Mouse/Descriptors.c index 9ad39f4d4..a93d51241 100644 --- a/Demos/Device/Mouse/Descriptors.c +++ b/Demos/Device/Mouse/Descriptors.c @@ -132,8 +132,8 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = TotalEndpoints: 1, Class: 0x03, - SubClass: 0x02, - Protocol: 0x01, + SubClass: 0x01, + Protocol: 0x02, InterfaceStrIndex: NO_DESCRIPTOR }, diff --git a/Demos/Host/CDCHost/ConfigDescriptor.c b/Demos/Host/CDCHost/ConfigDescriptor.c index 972d3e68c..9a23fc3fa 100644 --- a/Demos/Host/CDCHost/ConfigDescriptor.c +++ b/Demos/Host/CDCHost/ConfigDescriptor.c @@ -181,11 +181,11 @@ DESCRIPTOR_COMPARATOR(NextCDCControlInterface) (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == CDC_CONTROL_SUBCLASS) && (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == CDC_CONTROL_PROTOCOL)) { - return Descriptor_Search_Found; + return DESCRIPTOR_SEARCH_Found; } } - return Descriptor_Search_NotFound; + return DESCRIPTOR_SEARCH_NotFound; } /** Descriptor comparator function. This comparator function is can be called while processing an attached USB device's @@ -205,11 +205,11 @@ DESCRIPTOR_COMPARATOR(NextCDCDataInterface) (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == CDC_DATA_SUBCLASS) && (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == CDC_DATA_PROTOCOL)) { - return Descriptor_Search_Found; + return DESCRIPTOR_SEARCH_Found; } } - return Descriptor_Search_NotFound; + return DESCRIPTOR_SEARCH_NotFound; } /** Descriptor comparator function. This comparator function is can be called while processing an attached USB device's @@ -230,12 +230,12 @@ DESCRIPTOR_COMPARATOR(NextInterfaceCDCDataEndpoint) USB_Descriptor_Endpoint_t).Attributes & EP_TYPE_MASK); if ((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT)) - return Descriptor_Search_Found; + return DESCRIPTOR_SEARCH_Found; } else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface) { - return Descriptor_Search_Fail; + return DESCRIPTOR_SEARCH_Fail; } - return Descriptor_Search_NotFound; + return DESCRIPTOR_SEARCH_NotFound; } diff --git a/Demos/Host/GenericHIDHost/ConfigDescriptor.c b/Demos/Host/GenericHIDHost/ConfigDescriptor.c index caf88ef05..7dc7d3e87 100644 --- a/Demos/Host/GenericHIDHost/ConfigDescriptor.c +++ b/Demos/Host/GenericHIDHost/ConfigDescriptor.c @@ -143,12 +143,12 @@ DESCRIPTOR_COMPARATOR(NextHIDInterface) if (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == HID_CLASS) { /* Indicate that the descriptor being searched for has been found */ - return Descriptor_Search_Found; + return DESCRIPTOR_SEARCH_Found; } } /* Current descriptor does not match what this comparator is looking for */ - return Descriptor_Search_NotFound; + return DESCRIPTOR_SEARCH_NotFound; } /** Descriptor comparator function. This comparator function is can be called while processing an attached USB device's @@ -166,14 +166,14 @@ DESCRIPTOR_COMPARATOR(NextInterfaceHIDDataEndpoint) if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint) { /* Indicate that the descriptor being searched for has been found */ - return Descriptor_Search_Found; + return DESCRIPTOR_SEARCH_Found; } else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface) { /* Indicate that the search has failed prematurely and should be aborted */ - return Descriptor_Search_Fail; + return DESCRIPTOR_SEARCH_Fail; } /* Current descriptor does not match what this comparator is looking for */ - return Descriptor_Search_NotFound; + return DESCRIPTOR_SEARCH_NotFound; } diff --git a/Demos/Host/KeyboardHost/ConfigDescriptor.c b/Demos/Host/KeyboardHost/ConfigDescriptor.c index 1735401cf..7cbf9484b 100644 --- a/Demos/Host/KeyboardHost/ConfigDescriptor.c +++ b/Demos/Host/KeyboardHost/ConfigDescriptor.c @@ -117,9 +117,9 @@ DESCRIPTOR_COMPARATOR(NextKeyboardInterface) { /* Check the HID descriptor class and protocol, break out if correct class/protocol interface found */ if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == KEYBOARD_CLASS) && - (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == KEYBOARD_PROTOCOL)) + (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Subclass == KEYBOARD_SUBCLASS)) { - return Descriptor_Search_Found; + return DESCRIPTOR_SEARCH_Found; } } @@ -140,12 +140,12 @@ DESCRIPTOR_COMPARATOR(NextInterfaceKeyboardDataEndpoint) if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint) { if (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Endpoint_t).EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN) - return Descriptor_Search_Found; + return DESCRIPTOR_SEARCH_Found; } else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface) { - return Descriptor_Search_Fail; + return DESCRIPTOR_SEARCH_Fail; } - return Descriptor_Search_NotFound; + return DESCRIPTOR_SEARCH_NotFound; } diff --git a/Demos/Host/KeyboardHostWithParser/ConfigDescriptor.c b/Demos/Host/KeyboardHostWithParser/ConfigDescriptor.c index 73f0ce216..9b56823ef 100644 --- a/Demos/Host/KeyboardHostWithParser/ConfigDescriptor.c +++ b/Demos/Host/KeyboardHostWithParser/ConfigDescriptor.c @@ -123,11 +123,11 @@ DESCRIPTOR_COMPARATOR(NextKeyboardInterface) if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == KEYBOARD_CLASS) && (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == KEYBOARD_PROTOCOL)) { - return Descriptor_Search_Found; + return DESCRIPTOR_SEARCH_Found; } } - return Descriptor_Search_NotFound; + return DESCRIPTOR_SEARCH_NotFound; } /** Descriptor comparator function. This comparator function is can be called while processing an attached USB device's @@ -144,14 +144,14 @@ DESCRIPTOR_COMPARATOR(NextInterfaceKeyboardDataEndpoint) if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint) { if (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Endpoint_t).EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN) - return Descriptor_Search_Found; + return DESCRIPTOR_SEARCH_Found; } else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface) { - return Descriptor_Search_Fail; + return DESCRIPTOR_SEARCH_Fail; } - return Descriptor_Search_NotFound; + return DESCRIPTOR_SEARCH_NotFound; } /** Descriptor comparator function. This comparator function is can be called while processing an attached USB device's @@ -165,7 +165,7 @@ DESCRIPTOR_COMPARATOR(NextInterfaceKeyboardDataEndpoint) DESCRIPTOR_COMPARATOR(NextHID) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_HID) - return Descriptor_Search_Found; + return DESCRIPTOR_SEARCH_Found; else - return Descriptor_Search_NotFound; + return DESCRIPTOR_SEARCH_NotFound; } diff --git a/Demos/Host/KeyboardHostWithParser/HIDReport.c b/Demos/Host/KeyboardHostWithParser/HIDReport.c index d177a8877..b985a45fe 100644 --- a/Demos/Host/KeyboardHostWithParser/HIDReport.c +++ b/Demos/Host/KeyboardHostWithParser/HIDReport.c @@ -64,7 +64,7 @@ uint8_t GetHIDReportData(void) return ParseControlError; /* Send the HID report to the parser for processing */ - if (ProcessHIDReport(HIDReportData, HIDReportSize, &HIDReportInfo) != HID_PARSE_Successful) + if (USB_ProcessHIDReport(HIDReportData, HIDReportSize, &HIDReportInfo) != HID_PARSE_Successful) return ParseError; return ParseSuccessful; diff --git a/Demos/Host/KeyboardHostWithParser/KeyboardHostWithParser.c b/Demos/Host/KeyboardHostWithParser/KeyboardHostWithParser.c index d7d5f9414..ff4ae75c8 100644 --- a/Demos/Host/KeyboardHostWithParser/KeyboardHostWithParser.c +++ b/Demos/Host/KeyboardHostWithParser/KeyboardHostWithParser.c @@ -310,7 +310,7 @@ void ProcessKeyboardReport(uint8_t* KeyboardReport) (ReportItem->ItemType == REPORT_ITEM_TYPE_In)) { /* Retrieve the keyboard scancode from the report data retrieved from the device */ - bool FoundData = GetReportItemInfo(KeyboardReport, ReportItem); + bool FoundData = USB_GetHIDReportItemInfo(KeyboardReport, ReportItem); /* For multi-report devices - if the requested data was not in the issued report, continue */ if (!(FoundData)) diff --git a/Demos/Host/MassStorageHost/ConfigDescriptor.c b/Demos/Host/MassStorageHost/ConfigDescriptor.c index 1540590ff..6642e1c5c 100644 --- a/Demos/Host/MassStorageHost/ConfigDescriptor.c +++ b/Demos/Host/MassStorageHost/ConfigDescriptor.c @@ -137,11 +137,11 @@ DESCRIPTOR_COMPARATOR(NextMassStorageInterface) (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == MASS_STORE_SUBCLASS) && (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == MASS_STORE_PROTOCOL)) { - return Descriptor_Search_Found; + return DESCRIPTOR_SEARCH_Found; } } - return Descriptor_Search_NotFound; + return DESCRIPTOR_SEARCH_NotFound; } /** Descriptor comparator function. This comparator function is can be called while processing an attached USB device's @@ -162,12 +162,12 @@ DESCRIPTOR_COMPARATOR(NextInterfaceBulkDataEndpoint) /* Check the endpoint type, break out if correct BULK type endpoint found */ if (EndpointType == EP_TYPE_BULK) - return Descriptor_Search_Found; + return DESCRIPTOR_SEARCH_Found; } else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface) { - return Descriptor_Search_Fail; + return DESCRIPTOR_SEARCH_Fail; } - return Descriptor_Search_NotFound; + return DESCRIPTOR_SEARCH_NotFound; } diff --git a/Demos/Host/MouseHost/ConfigDescriptor.c b/Demos/Host/MouseHost/ConfigDescriptor.c index 2c842ac99..ef53e7c42 100644 --- a/Demos/Host/MouseHost/ConfigDescriptor.c +++ b/Demos/Host/MouseHost/ConfigDescriptor.c @@ -69,15 +69,15 @@ uint8_t ProcessConfigurationDescriptor(void) return InvalidConfigDataReturned; /* Get the mouse interface from the configuration descriptor */ - if (USB_Host_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextMouseInterface)) + if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextMouseInterface)) { /* Descriptor not found, error out */ return NoHIDInterfaceFound; } /* Get the mouse interface's data endpoint descriptor */ - if (USB_Host_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - NextInterfaceMouseDataEndpoint)) + if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, + NextInterfaceMouseDataEndpoint)) { /* Descriptor not found, error out */ return NoEndpointFound; @@ -121,12 +121,12 @@ DESCRIPTOR_COMPARATOR(NextMouseInterface) (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == MOUSE_PROTOCOL)) { /* Indicate that the descriptor being searched for has been found */ - return Descriptor_Search_Found; + return DESCRIPTOR_SEARCH_Found; } } /* Current descriptor does not match what this comparator is looking for */ - return Descriptor_Search_NotFound; + return DESCRIPTOR_SEARCH_NotFound; } /** Descriptor comparator function. This comparator function is can be called while processing an attached USB device's @@ -147,15 +147,15 @@ DESCRIPTOR_COMPARATOR(NextInterfaceMouseDataEndpoint) if (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Endpoint_t).EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN) { /* Indicate that the descriptor being searched for has been found */ - return Descriptor_Search_Found; + return DESCRIPTOR_SEARCH_Found; } } else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface) { /* Indicate that the search has failed prematurely and should be aborted */ - return Descriptor_Search_Fail; + return DESCRIPTOR_SEARCH_Fail; } /* Current descriptor does not match what this comparator is looking for */ - return Descriptor_Search_NotFound; + return DESCRIPTOR_SEARCH_NotFound; } diff --git a/Demos/Host/MouseHostWithParser/ConfigDescriptor.c b/Demos/Host/MouseHostWithParser/ConfigDescriptor.c index 9f0c444e2..486a0c7fb 100644 --- a/Demos/Host/MouseHostWithParser/ConfigDescriptor.c +++ b/Demos/Host/MouseHostWithParser/ConfigDescriptor.c @@ -123,11 +123,11 @@ DESCRIPTOR_COMPARATOR(NextMouseInterface) if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == MOUSE_CLASS) && (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == MOUSE_PROTOCOL)) { - return Descriptor_Search_Found; + return DESCRIPTOR_SEARCH_Found; } } - return Descriptor_Search_NotFound; + return DESCRIPTOR_SEARCH_NotFound; } /** Descriptor comparator function. This comparator function is can be called while processing an attached USB device's @@ -144,14 +144,14 @@ DESCRIPTOR_COMPARATOR(NextInterfaceMouseDataEndpoint) if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint) { if (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Endpoint_t).EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN) - return Descriptor_Search_Found; + return DESCRIPTOR_SEARCH_Found; } else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface) { - return Descriptor_Search_Fail; + return DESCRIPTOR_SEARCH_Fail; } - return Descriptor_Search_NotFound; + return DESCRIPTOR_SEARCH_NotFound; } /** Descriptor comparator function. This comparator function is can be called while processing an attached USB device's @@ -165,7 +165,7 @@ DESCRIPTOR_COMPARATOR(NextInterfaceMouseDataEndpoint) DESCRIPTOR_COMPARATOR(NextHID) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_HID) - return Descriptor_Search_Found; + return DESCRIPTOR_SEARCH_Found; else - return Descriptor_Search_NotFound; + return DESCRIPTOR_SEARCH_NotFound; } diff --git a/Demos/Host/MouseHostWithParser/HIDReport.c b/Demos/Host/MouseHostWithParser/HIDReport.c index 3d06bb140..176f18cf6 100644 --- a/Demos/Host/MouseHostWithParser/HIDReport.c +++ b/Demos/Host/MouseHostWithParser/HIDReport.c @@ -64,7 +64,7 @@ uint8_t GetHIDReportData(void) return ParseControlError; /* Send the HID report to the parser for processing */ - if (ProcessHIDReport(HIDReportData, HIDReportSize, &HIDReportInfo) != HID_PARSE_Successful) + if (USB_ProcessHIDReport(HIDReportData, HIDReportSize, &HIDReportInfo) != HID_PARSE_Successful) return ParseError; return ParseSuccessful; diff --git a/Demos/Host/MouseHostWithParser/HIDReport.h b/Demos/Host/MouseHostWithParser/HIDReport.h index f5ad40be3..a4fc76fa7 100644 --- a/Demos/Host/MouseHostWithParser/HIDReport.h +++ b/Demos/Host/MouseHostWithParser/HIDReport.h @@ -37,7 +37,7 @@ #define _HID_REPORT_H_ /* Includes: */ - #include // HID Class Report Parser + #include // USB Functionality #include "MouseHostWithParser.h" diff --git a/Demos/Host/MouseHostWithParser/MouseHostWithParser.c b/Demos/Host/MouseHostWithParser/MouseHostWithParser.c index 259da2a60..44c68eea7 100644 --- a/Demos/Host/MouseHostWithParser/MouseHostWithParser.c +++ b/Demos/Host/MouseHostWithParser/MouseHostWithParser.c @@ -312,7 +312,7 @@ void ProcessMouseReport(uint8_t* MouseReport) (ReportItem->ItemType == REPORT_ITEM_TYPE_In)) { /* Get the mouse button value */ - FoundData = GetReportItemInfo(MouseReport, ReportItem); + FoundData = USB_GetHIDReportItemInfo(MouseReport, ReportItem); /* For multi-report devices - if the requested data was not in the issued report, continue */ if (!(FoundData)) @@ -328,7 +328,7 @@ void ProcessMouseReport(uint8_t* MouseReport) (ReportItem->ItemType == REPORT_ITEM_TYPE_In)) { /* Get the mouse relative position value */ - FoundData = GetReportItemInfo(MouseReport, ReportItem); + FoundData = USB_GetHIDReportItemInfo(MouseReport, ReportItem); /* For multi-report devices - if the requested data was not in the issued report, continue */ if (!(FoundData)) diff --git a/Demos/Host/StillImageHost/ConfigDescriptor.c b/Demos/Host/StillImageHost/ConfigDescriptor.c index 2456e35af..5e2916ba2 100644 --- a/Demos/Host/StillImageHost/ConfigDescriptor.c +++ b/Demos/Host/StillImageHost/ConfigDescriptor.c @@ -156,11 +156,11 @@ DESCRIPTOR_COMPARATOR(NextStillImageInterface) (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == SIMAGE_SUBCLASS) && (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == SIMAGE_PROTOCOL)) { - return Descriptor_Search_Found; + return DESCRIPTOR_SEARCH_Found; } } - return Descriptor_Search_NotFound; + return DESCRIPTOR_SEARCH_NotFound; } /** Descriptor comparator function. This comparator function is can be called while processing an attached USB device's @@ -180,12 +180,12 @@ DESCRIPTOR_COMPARATOR(NextSImageInterfaceDataEndpoint) USB_Descriptor_Endpoint_t).Attributes & EP_TYPE_MASK); if ((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT)) - return Descriptor_Search_Found; + return DESCRIPTOR_SEARCH_Found; } else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface) { - return Descriptor_Search_Fail; + return DESCRIPTOR_SEARCH_Fail; } - return Descriptor_Search_NotFound; + return DESCRIPTOR_SEARCH_NotFound; } -- cgit v1.2.3