From d1607598faf4ce2ef8e1a0385f75036ffb50ea9b Mon Sep 17 00:00:00 2001 From: Alessandro Gatti Date: Fri, 25 Jul 2025 13:54:41 +0200 Subject: [PATCH] esp32/usb: Fix building with USB CDC disabled. This commit fixes the build issues in the ESP32 port that arise when explicitly disabling USB CDC support. The USB support code gated the USB serial number retrieval behind the USB CDC support definition, even though all USB devices must be able to be queried for their serial number. Signed-off-by: Alessandro Gatti --- ports/esp32/usb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/esp32/usb.c b/ports/esp32/usb.c index 3ce3d04581..750dd59ee6 100644 --- a/ports/esp32/usb.c +++ b/ports/esp32/usb.c @@ -28,16 +28,16 @@ #include "py/mphal.h" #include "usb.h" -#if MICROPY_HW_USB_CDC -#include "esp_rom_gpio.h" +#if MICROPY_HW_ENABLE_USBDEV + #include "esp_mac.h" +#include "esp_rom_gpio.h" #include "esp_private/usb_phy.h" #include "shared/tinyusb/mp_usbd.h" static usb_phy_handle_t phy_hdl; - void usb_init(void) { // ref: https://github.com/espressif/esp-usb/blob/4b6a798d0bed444fff48147c8dcdbbd038e92892/device/esp_tinyusb/tinyusb.c @@ -77,4 +77,4 @@ void mp_usbd_port_get_serial_number(char *serial_buf) { mp_usbd_hex_str(serial_buf, mac, sizeof(mac)); } -#endif // MICROPY_HW_USB_CDC +#endif // MICROPY_HW_ENABLE_USBDEV