Skip to content

Commit 8635094

Browse files
committed
fix(class/cdc): add altsetting 1 for ecm/ncm
Signed-off-by: sakumisu <1203593632@qq.com>
1 parent 7819186 commit 8635094

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

class/cdc/usb_cdc.h

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,8 @@ struct cdc_ncm_ndp16 {
550550

551551
#define DBVAL_BE(x) ((x >> 24) & 0xFF), ((x >> 16) & 0xFF), ((x >> 8) & 0xFF), (x & 0xFF)
552552

553-
/*Length of template descriptor: 71 bytes*/
554-
#define CDC_ECM_DESCRIPTOR_LEN (8 + 9 + 5 + 5 + 13 + 7 + 9 + 7 + 7)
553+
/*Length of template descriptor: 79 bytes*/
554+
#define CDC_ECM_DESCRIPTOR_LEN (8 + 9 + 5 + 5 + 13 + 7 + 9 + 9 + 7 + 7)
555555
// clang-format off
556556
#define CDC_ECM_DESCRIPTOR_INIT(bFirstInterface, int_ep, out_ep, in_ep, wMaxPacketSize, str_idx) \
557557
/* Interface Associate */ \
@@ -600,6 +600,15 @@ struct cdc_ncm_ndp16 {
600600
USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \
601601
(uint8_t)(bFirstInterface + 1), /* bInterfaceNumber */ \
602602
0x00, /* bAlternateSetting */ \
603+
0x00, /* bNumEndpoints */ \
604+
CDC_DATA_INTERFACE_CLASS, /* bInterfaceClass */ \
605+
0x00, /* bInterfaceSubClass */ \
606+
0x00, /* bInterfaceProtocol */ \
607+
0x00, /* iInterface */ \
608+
0x09, /* bLength */ \
609+
USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \
610+
(uint8_t)(bFirstInterface + 1), /* bInterfaceNumber */ \
611+
0x01, /* bAlternateSetting */ \
603612
0x02, /* bNumEndpoints */ \
604613
CDC_DATA_INTERFACE_CLASS, /* bInterfaceClass */ \
605614
0x00, /* bInterfaceSubClass */ \
@@ -619,8 +628,8 @@ struct cdc_ncm_ndp16 {
619628
0x00 /* bInterval */
620629
// clang-format on
621630

622-
/*Length of template descriptor: 77 bytes*/
623-
#define CDC_NCM_DESCRIPTOR_LEN (8 + 9 + 5 + 5 + 13 + 6 + 7 + 9 + 7 + 7)
631+
/*Length of template descriptor: 86 bytes*/
632+
#define CDC_NCM_DESCRIPTOR_LEN (8 + 9 + 5 + 5 + 13 + 6 + 7 + 9 + 9 + 7 + 7)
624633
// clang-format off
625634
#define CDC_NCM_DESCRIPTOR_INIT(bFirstInterface, int_ep, out_ep, in_ep, wMaxPacketSize, str_idx) \
626635
/* Interface Associate */ \
@@ -674,6 +683,15 @@ struct cdc_ncm_ndp16 {
674683
USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \
675684
(uint8_t)(bFirstInterface + 1), /* bInterfaceNumber */ \
676685
0x00, /* bAlternateSetting */ \
686+
0x00, /* bNumEndpoints */ \
687+
CDC_DATA_INTERFACE_CLASS, /* bInterfaceClass */ \
688+
0x00, /* bInterfaceSubClass */ \
689+
0x00, /* bInterfaceProtocol */ \
690+
0x00, /* iInterface */ \
691+
0x09, /* bLength */ \
692+
USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \
693+
(uint8_t)(bFirstInterface + 1), /* bInterfaceNumber */ \
694+
0x01, /* bAlternateSetting */ \
677695
0x02, /* bNumEndpoints */ \
678696
CDC_DATA_INTERFACE_CLASS, /* bInterfaceClass */ \
679697
0x00, /* bInterfaceSubClass */ \

0 commit comments

Comments
 (0)