From 86350946ab047197e46bfcb70f8cefb0417705b8 Mon Sep 17 00:00:00 2001 From: sakumisu <1203593632@qq.com> Date: Tue, 7 Apr 2026 21:27:48 +0800 Subject: fix(class/cdc): add altsetting 1 for ecm/ncm Signed-off-by: sakumisu <1203593632@qq.com> --- class/cdc/usb_cdc.h | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/class/cdc/usb_cdc.h b/class/cdc/usb_cdc.h index 6a8e807d..a21bc3b2 100644 --- a/class/cdc/usb_cdc.h +++ b/class/cdc/usb_cdc.h @@ -550,8 +550,8 @@ struct cdc_ncm_ndp16 { #define DBVAL_BE(x) ((x >> 24) & 0xFF), ((x >> 16) & 0xFF), ((x >> 8) & 0xFF), (x & 0xFF) -/*Length of template descriptor: 71 bytes*/ -#define CDC_ECM_DESCRIPTOR_LEN (8 + 9 + 5 + 5 + 13 + 7 + 9 + 7 + 7) +/*Length of template descriptor: 79 bytes*/ +#define CDC_ECM_DESCRIPTOR_LEN (8 + 9 + 5 + 5 + 13 + 7 + 9 + 9 + 7 + 7) // clang-format off #define CDC_ECM_DESCRIPTOR_INIT(bFirstInterface, int_ep, out_ep, in_ep, wMaxPacketSize, str_idx) \ /* Interface Associate */ \ @@ -600,6 +600,15 @@ struct cdc_ncm_ndp16 { USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ (uint8_t)(bFirstInterface + 1), /* bInterfaceNumber */ \ 0x00, /* bAlternateSetting */ \ + 0x00, /* bNumEndpoints */ \ + CDC_DATA_INTERFACE_CLASS, /* bInterfaceClass */ \ + 0x00, /* bInterfaceSubClass */ \ + 0x00, /* bInterfaceProtocol */ \ + 0x00, /* iInterface */ \ + 0x09, /* bLength */ \ + USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ + (uint8_t)(bFirstInterface + 1), /* bInterfaceNumber */ \ + 0x01, /* bAlternateSetting */ \ 0x02, /* bNumEndpoints */ \ CDC_DATA_INTERFACE_CLASS, /* bInterfaceClass */ \ 0x00, /* bInterfaceSubClass */ \ @@ -619,8 +628,8 @@ struct cdc_ncm_ndp16 { 0x00 /* bInterval */ // clang-format on -/*Length of template descriptor: 77 bytes*/ -#define CDC_NCM_DESCRIPTOR_LEN (8 + 9 + 5 + 5 + 13 + 6 + 7 + 9 + 7 + 7) +/*Length of template descriptor: 86 bytes*/ +#define CDC_NCM_DESCRIPTOR_LEN (8 + 9 + 5 + 5 + 13 + 6 + 7 + 9 + 9 + 7 + 7) // clang-format off #define CDC_NCM_DESCRIPTOR_INIT(bFirstInterface, int_ep, out_ep, in_ep, wMaxPacketSize, str_idx) \ /* Interface Associate */ \ @@ -674,6 +683,15 @@ struct cdc_ncm_ndp16 { USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ (uint8_t)(bFirstInterface + 1), /* bInterfaceNumber */ \ 0x00, /* bAlternateSetting */ \ + 0x00, /* bNumEndpoints */ \ + CDC_DATA_INTERFACE_CLASS, /* bInterfaceClass */ \ + 0x00, /* bInterfaceSubClass */ \ + 0x00, /* bInterfaceProtocol */ \ + 0x00, /* iInterface */ \ + 0x09, /* bLength */ \ + USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ + (uint8_t)(bFirstInterface + 1), /* bInterfaceNumber */ \ + 0x01, /* bAlternateSetting */ \ 0x02, /* bNumEndpoints */ \ CDC_DATA_INTERFACE_CLASS, /* bInterfaceClass */ \ 0x00, /* bInterfaceSubClass */ \ -- cgit v1.3.1