From 883c0a5dc5fd3bb3cb099c1373c9288a8b788054 Mon Sep 17 00:00:00 2001 From: yukelab Date: Wed, 5 Jun 2024 11:10:08 +0800 Subject: [PATCH] review cdc-ecm enum success but comunication error 1. review usbd_cdc_ecm_eth_tx send data fail 2. review CDC_ECM_DESCRIPTOR_INIT macro wMaxSegmentSize parameter error --- class/cdc/usb_cdc.h | 2 +- class/cdc/usbd_cdc_ecm.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/class/cdc/usb_cdc.h b/class/cdc/usb_cdc.h index b8a544f3..2bf0a17a 100644 --- a/class/cdc/usb_cdc.h +++ b/class/cdc/usb_cdc.h @@ -588,7 +588,7 @@ eth_statistics, wMaxSegmentSize, wNumberMCFilters, bNumberPowerFilters, str_idx) CDC_FUNC_DESC_ETHERNET_NETWORKING, /* Ethernet Networking functional descriptor subtype */\ str_idx, /* Device's MAC string index */\ DBVAL_BE(eth_statistics), /* Ethernet statistics (bitmap) */\ - WBVAL(wMaxPacketSize),/* wMaxSegmentSize: Ethernet Maximum Segment size, typically 1514 bytes */\ + WBVAL(wMaxSegmentSize),/* wMaxSegmentSize: Ethernet Maximum Segment size, typically 1514 bytes */\ WBVAL(wNumberMCFilters), /* wNumberMCFilters: the number of multicast filters */\ bNumberPowerFilters, /* bNumberPowerFilters: the number of wakeup power filters */\ 0x07, /* bLength */ \ diff --git a/class/cdc/usbd_cdc_ecm.c b/class/cdc/usbd_cdc_ecm.c index 2e1e8664..b0c1217d 100644 --- a/class/cdc/usbd_cdc_ecm.c +++ b/class/cdc/usbd_cdc_ecm.c @@ -210,9 +210,7 @@ int usbd_cdc_ecm_eth_tx(struct pbuf *p) buffer += q->len; } - g_cdc_ecm_tx_data_length = p->tot_len; - - return usbd_cdc_ecm_start_write(g_cdc_ecm_tx_buffer, g_cdc_ecm_tx_data_length); + return usbd_cdc_ecm_start_write(g_cdc_ecm_tx_buffer, p->tot_len); } #endif @@ -244,4 +242,4 @@ void usbd_cdc_ecm_set_connect_speed(uint32_t speed[2]) __WEAK void usbd_cdc_ecm_data_recv_done(uint8_t *buf, uint32_t len) { -} \ No newline at end of file +}