usb: cdc: add option to force IAD

Interface Association descriptor has to be used with Windows 7.
Add CONFIG_CDC_ACM_IAD option to force its usage, disabled by default.

Signed-off-by: Marcin Szymczyk <Marcin.Szymczyk@nordicsemi.no>
This commit is contained in:
Marcin Szymczyk 2019-03-06 12:29:24 +01:00 committed by Anas Nashif
parent a30950c64b
commit b1f3825ea3
2 changed files with 12 additions and 4 deletions

View file

@ -46,6 +46,14 @@ config CDC_ACM_BULK_EP_MPS
help
CDC ACM class bulk endpoints size
config CDC_ACM_IAD
bool "Force using Interface Association Descriptor"
default n
help
IAD should not be required for non-composite CDC ACM device,
but Windows 7 fails to properly enumerate without it.
Enable if you want CDC ACM to work with Windows 7.
module = USB_CDC_ACM
module-str = usb cdc acm
source "subsys/logging/Kconfig.template.log_config"

View file

@ -78,7 +78,7 @@ LOG_MODULE_REGISTER(usb_cdc_acm);
#define ACM_IN_EP_IDX 2
struct usb_cdc_acm_config {
#ifdef CONFIG_USB_COMPOSITE_DEVICE
#if (CONFIG_USB_COMPOSITE_DEVICE || CONFIG_CDC_ACM_IAD)
struct usb_association_descriptor iad_cdc;
#endif
struct usb_if_descriptor if0;
@ -989,7 +989,7 @@ static const struct uart_driver_api cdc_acm_driver_api = {
.endpoint = cdc_acm_ep_data_##x, \
};
#if CONFIG_USB_COMPOSITE_DEVICE
#if (CONFIG_USB_COMPOSITE_DEVICE || CONFIG_CDC_ACM_IAD)
#define DEFINE_CDC_ACM_DESCR(x, int_ep_addr, out_ep_addr, in_ep_addr) \
USBD_CLASS_DESCR_DEFINE(primary, x) \
struct usb_cdc_acm_config cdc_acm_cfg_##x = { \
@ -1014,7 +1014,7 @@ static const struct uart_driver_api cdc_acm_driver_api = {
CONFIG_CDC_ACM_BULK_EP_MPS, \
0x00), \
}
#else /* CONFIG_USB_COMPOSITE_DEVICE */
#else /* (CONFIG_USB_COMPOSITE_DEVICE || CONFIG_CDC_ACM_IAD) */
#define DEFINE_CDC_ACM_DESCR(x, int_ep_addr, out_ep_addr, in_ep_addr) \
USBD_CLASS_DESCR_DEFINE(primary, x) \
struct usb_cdc_acm_config cdc_acm_cfg_##x = { \
@ -1038,7 +1038,7 @@ static const struct uart_driver_api cdc_acm_driver_api = {
CONFIG_CDC_ACM_BULK_EP_MPS, \
0x00), \
}
#endif /* CONFIG_USB_COMPOSITE_DEVICE */
#endif /* (CONFIG_USB_COMPOSITE_DEVICE || CONFIG_CDC_ACM_IAD) */
#define DEFINE_CDC_ACM_DEV_DATA(x, _) \
RING_BUF_DECLARE(rx_ringbuf_##x, \