forked from mfulz_github/qmk_firmware
Added support to the CDCHost demo for devices with mutiple CDC interfaces which are not the correct ACM type preceeding the desired ACM CDC interface.
This commit is contained in:
parent
cb7884da50
commit
51910b4505
|
@ -69,8 +69,8 @@ uint8_t ProcessConfigurationDescriptor(void)
|
||||||
if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration)
|
if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration)
|
||||||
return InvalidConfigDataReturned;
|
return InvalidConfigDataReturned;
|
||||||
|
|
||||||
/* Get the CDC interface from the configuration descriptor */
|
/* Get the CDC control interface from the configuration descriptor */
|
||||||
if (USB_Host_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextCDCInterface))
|
if (USB_Host_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextCDCControlInterface))
|
||||||
{
|
{
|
||||||
/* Descriptor not found, error out */
|
/* Descriptor not found, error out */
|
||||||
return NoCDCInterfaceFound;
|
return NoCDCInterfaceFound;
|
||||||
|
@ -83,12 +83,25 @@ uint8_t ProcessConfigurationDescriptor(void)
|
||||||
if (USB_Host_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
|
if (USB_Host_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
|
||||||
NextInterfaceCDCDataEndpoint))
|
NextInterfaceCDCDataEndpoint))
|
||||||
{
|
{
|
||||||
/* Get the next CDC interface from the configuration descriptor (CDC class has two CDC interfaces) */
|
/* Check to see if the control interface's notification pipe has been found, if so search for the data interface */
|
||||||
if (USB_Host_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextCDCInterface))
|
if (FoundEndpoints & (1 << CDC_NOTIFICATIONPIPE))
|
||||||
|
{
|
||||||
|
/* Get the next CDC data interface from the configuration descriptor (CDC class has two CDC interfaces) */
|
||||||
|
if (USB_Host_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextCDCDataInterface))
|
||||||
{
|
{
|
||||||
/* Descriptor not found, error out */
|
/* Descriptor not found, error out */
|
||||||
return NoCDCInterfaceFound;
|
return NoCDCInterfaceFound;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Get the next CDC control interface from the configuration descriptor (CDC class has two CDC interfaces) */
|
||||||
|
if (USB_Host_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextCDCControlInterface))
|
||||||
|
{
|
||||||
|
/* Descriptor not found, error out */
|
||||||
|
return NoCDCInterfaceFound;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Fetch the next bulk or interrupt endpoint from the current CDC interface */
|
/* Fetch the next bulk or interrupt endpoint from the current CDC interface */
|
||||||
if (USB_Host_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
|
if (USB_Host_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
|
||||||
|
@ -155,11 +168,11 @@ uint8_t ProcessConfigurationDescriptor(void)
|
||||||
* configuration descriptor, to search for a specific sub descriptor. It can also be used to abort the configuration
|
* configuration descriptor, to search for a specific sub descriptor. It can also be used to abort the configuration
|
||||||
* descriptor processing if an incompatible descriptor configuration is found.
|
* descriptor processing if an incompatible descriptor configuration is found.
|
||||||
*
|
*
|
||||||
* This comparator searches for the next Interface descriptor of the correct CDC Class, Subclass and Protocol values.
|
* This comparator searches for the next Interface descriptor of the correct CDC control Class, Subclass and Protocol values.
|
||||||
*
|
*
|
||||||
* \return A value from the DSEARCH_Return_ErrorCodes_t enum
|
* \return A value from the DSEARCH_Return_ErrorCodes_t enum
|
||||||
*/
|
*/
|
||||||
DESCRIPTOR_COMPARATOR(NextCDCInterface)
|
DESCRIPTOR_COMPARATOR(NextCDCControlInterface)
|
||||||
{
|
{
|
||||||
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
|
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
|
||||||
{
|
{
|
||||||
|
@ -170,7 +183,23 @@ DESCRIPTOR_COMPARATOR(NextCDCInterface)
|
||||||
{
|
{
|
||||||
return Descriptor_Search_Found;
|
return Descriptor_Search_Found;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Descriptor_Search_NotFound;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Descriptor comparator function. This comparator function is can be called while processing an attached USB device's
|
||||||
|
* configuration descriptor, to search for a specific sub descriptor. It can also be used to abort the configuration
|
||||||
|
* descriptor processing if an incompatible descriptor configuration is found.
|
||||||
|
*
|
||||||
|
* This comparator searches for the next Interface descriptor of the correct CDC data Class, Subclass and Protocol values.
|
||||||
|
*
|
||||||
|
* \return A value from the DSEARCH_Return_ErrorCodes_t enum
|
||||||
|
*/
|
||||||
|
DESCRIPTOR_COMPARATOR(NextCDCDataInterface)
|
||||||
|
{
|
||||||
|
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
|
||||||
|
{
|
||||||
/* Check the CDC descriptor class, subclass and protocol, break out if correct data interface found */
|
/* Check the CDC descriptor class, subclass and protocol, break out if correct data interface found */
|
||||||
if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == CDC_DATA_CLASS) &&
|
if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == CDC_DATA_CLASS) &&
|
||||||
(DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == CDC_DATA_SUBCLASS) &&
|
(DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == CDC_DATA_SUBCLASS) &&
|
||||||
|
|
|
@ -77,7 +77,8 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Configuration Descriptor Comparison Functions: */
|
/* Configuration Descriptor Comparison Functions: */
|
||||||
DESCRIPTOR_COMPARATOR(NextCDCInterface);
|
DESCRIPTOR_COMPARATOR(NextCDCControlInterface);
|
||||||
|
DESCRIPTOR_COMPARATOR(NextCDCDataInterface);
|
||||||
DESCRIPTOR_COMPARATOR(NextInterfaceCDCDataEndpoint);
|
DESCRIPTOR_COMPARATOR(NextInterfaceCDCDataEndpoint);
|
||||||
|
|
||||||
/* Function Prototypes: */
|
/* Function Prototypes: */
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
* code without having to be itself patched and recompiled first
|
* code without having to be itself patched and recompiled first
|
||||||
* - Added preprocessor checks and documentation to the bootloaders giving information about missing SIGNATURE_x defines due to
|
* - Added preprocessor checks and documentation to the bootloaders giving information about missing SIGNATURE_x defines due to
|
||||||
* outdated avr-libc versions.
|
* outdated avr-libc versions.
|
||||||
|
* - Added support to the CDCHost demo for devices with mutiple CDC interfaces which are not the correct ACM type preceeding the desired
|
||||||
|
* ACM CDC interface
|
||||||
*
|
*
|
||||||
* \section Sec_ChangeLog090401 Version 090401
|
* \section Sec_ChangeLog090401 Version 090401
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue