diff options
| author | sakumisu <[email protected]> | 2023-11-15 22:02:07 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2023-11-15 22:02:07 +0800 |
| commit | a8d40eb7060170a235c0127b9e49878bb1ca671a (patch) | |
| tree | b5ef1163d39cef9b3d99b08f32a098818d9dbb10 | |
| parent | aeffaea016f74cb5d6301b5ca5088c03e3dbe3a6 (diff) | |
fix ecm mac buffer size
| -rw-r--r-- | class/cdc/usbh_cdc_ecm.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/class/cdc/usbh_cdc_ecm.c b/class/cdc/usbh_cdc_ecm.c index d78ff1fb..d4546927 100644 --- a/class/cdc/usbh_cdc_ecm.c +++ b/class/cdc/usbh_cdc_ecm.c @@ -62,7 +62,7 @@ static int usbh_cdc_ecm_connect(struct usbh_hubport *hport, uint8_t intf) struct usb_endpoint_descriptor *ep_desc; int ret; uint8_t altsetting = 0; - char mac_buffer[8]; + char mac_buffer[12]; uint8_t *p; uint8_t cur_iface = 0xff; uint8_t mac_str_idx = 0xff; @@ -111,9 +111,7 @@ get_mac: return ret; } - uint8_t len = strlen(mac_buffer); - - for (int i = 0, j = 0; i < len; i += 2, j++) { + for (int i = 0, j = 0; i < 12; i += 2, j++) { char byte_str[3]; byte_str[0] = mac_buffer[i]; byte_str[1] = mac_buffer[i + 1]; @@ -123,7 +121,7 @@ get_mac: cdc_ecm_class->mac[j] = (unsigned char)byte; } - USB_LOG_INFO("CDC ECM mac address %02x: %02x: %02x: %02x: %02x: %02x\r\n", + USB_LOG_INFO("CDC ECM MAC address %02x:%02x:%02x:%02x:%02x:%02x\r\n", cdc_ecm_class->mac[0], cdc_ecm_class->mac[1], cdc_ecm_class->mac[2], |
