Skip to content

Commit b7443bf

Browse files
committed
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 <a.gatti@frob.it>
1 parent 5c7f629 commit b7443bf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ports/esp32/usb.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@
2828
#include "py/mphal.h"
2929
#include "usb.h"
3030

31-
#if MICROPY_HW_USB_CDC
32-
#include "esp_rom_gpio.h"
31+
#if MICROPY_HW_ENABLE_USBDEV
32+
3333
#include "esp_mac.h"
34+
#include "esp_rom_gpio.h"
3435
#include "esp_private/usb_phy.h"
3536

3637
#include "shared/tinyusb/mp_usbd.h"
3738

3839
static usb_phy_handle_t phy_hdl;
3940

40-
4141
void usb_init(void) {
4242
// ref: https://github.com/espressif/esp-usb/blob/4b6a798d0bed444fff48147c8dcdbbd038e92892/device/esp_tinyusb/tinyusb.c
4343

@@ -77,4 +77,4 @@ void mp_usbd_port_get_serial_number(char *serial_buf) {
7777
mp_usbd_hex_str(serial_buf, mac, sizeof(mac));
7878
}
7979

80-
#endif // MICROPY_HW_USB_CDC
80+
#endif // MICROPY_HW_ENABLE_USBDEV

0 commit comments

Comments
 (0)