In file usb_cdc.c, lines 406-410 are as follows:
/* Get count of endpoints for a specific configuration */
USB_Cdc_Get_Desc_Info(cdc_obj_ptr, USB_CDC_EP_COUNT, &ep_count);
/* Get count of interfaces for a specific configuration */
USB_Cdc_Get_Desc_Info(cdc_obj_ptr, USB_CDC_INTERFACE_COUNT, &max_if_count);
cdc_obj_ptr->max_supported_interfaces = max_if_count;
The first call appears to be dead. ep_count is not used anywhere after it is set.
The second call, and the setting of max_supported_interfaces, is RNDIS-specific. max_supported_interfaces is only used in routine PSTN_Rndis_Message_Set(), in usb_cdc_pstn.c, at lines 615-616:
if(!(cdc_pstn_ptr->current_interface <
cdc_obj_ptr->max_supported_interfaces))
I'd like to suggest that lines 406-407 be deleted, as dead code.
I'd further like to suggest that lines 408-410 be guarded as follows:
#if USBCFG_DEV_RNDIS_SUPPORT
/* Get count of interfaces for a specific configuration */
USB_Cdc_Get_Desc_Info(cdc_obj_ptr, USB_CDC_INTERFACE_COUNT, &max_if_count);
cdc_obj_ptr->max_supported_interfaces = max_if_count;
#endif
And, while we're on the subject, in file usb_cdc.h, lines 130-134:
uint8_t max_supported_interfaces;
#if USBCFG_DEV_RNDIS_SUPPORT
/* rndis specific configuration */
usb_rndis_info_struct_t rndis_info;
#endif
should probably be rearranged to:
#if USBCFG_DEV_RNDIS_SUPPORT
uint8_t max_supported_interfaces;
/* rndis specific configuration */
usb_rndis_info_struct_t rndis_info;
#endif
Hi, John
Thanks for your comments!
(1). This is indeed a dead code. We will remove it in next release.
(2). It will be treated as RNDIS-specific in next release.
Good suggestion! Thanks again!:smileyhappy:
Hi John,
I have reported this to USB stack team, and will let you know when I have any feedback.Thanks for your patience!
Have a great day,
Kan
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------