From 8c8d60fb8071b0486cb16deb096122ce7b3a747f Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Sat, 27 Feb 2021 15:05:00 +0100 Subject: [PATCH] Fix for CIRCUITPY_USB_MSC=0 Avoid undefined functions when MSC is disabled. --- supervisor/shared/usb/tusb_config.h | 2 +- supervisor/shared/usb/usb.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/supervisor/shared/usb/tusb_config.h b/supervisor/shared/usb/tusb_config.h index bff7bd6b55..6768101190 100644 --- a/supervisor/shared/usb/tusb_config.h +++ b/supervisor/shared/usb/tusb_config.h @@ -70,7 +70,7 @@ #define CFG_TUD_CDC 1 #endif -#define CFG_TUD_MSC 1 +#define CFG_TUD_MSC CIRCUITPY_USB_MSC #define CFG_TUD_HID CIRCUITPY_USB_HID #define CFG_TUD_MIDI CIRCUITPY_USB_MIDI #define CFG_TUD_VENDOR CIRCUITPY_USB_VENDOR diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c index aa35b95e60..614bf85e05 100644 --- a/supervisor/shared/usb/usb.c +++ b/supervisor/shared/usb/usb.c @@ -131,12 +131,16 @@ void usb_irq_handler(void) { // Invoked when device is mounted void tud_mount_cb(void) { +#if CIRCUITPY_USB_MSC usb_msc_mount(); +#endif } // Invoked when device is unmounted void tud_umount_cb(void) { +#if CIRCUITPY_USB_MSC usb_msc_umount(); +#endif } // Invoked when usb bus is suspended