Skip to content

Commit 518db8a

Browse files
committed
shared/filesystem: mount SD at filesystem_init for reliable MSC probe
The lazy automount in tud_msc_test_unit_ready_cb can lose races with macOS's USB MSC probe timing -- the host asks whether LUN 1 is ready before the card has finished mounting, sees NOT_READY, and may give up before trying again. Mounting during filesystem_init ensures the SD card is live by the time USB enumerates, so the first probe succeeds. Affects boards that define DEFAULT_SD_CARD_DETECT; behavior on boards without an auto-mount path is unchanged.
1 parent 26f70c1 commit 518db8a

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

supervisor/shared/filesystem.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,12 @@ bool filesystem_init(bool create_allowed, bool force_create) {
219219

220220
#if CIRCUITPY_SDCARDIO
221221
sdcardio_init();
222+
#ifdef DEFAULT_SD_CARD_DETECT
223+
// Mount the SD card now so it's ready when USB enumerates.
224+
// Lazy mount from tud_msc_test_unit_ready_cb can lose races with
225+
// macOS's probe timing.
226+
automount_sd_card();
227+
#endif
222228
#endif
223229

224230
return true;

0 commit comments

Comments
 (0)