Skip to content

Commit 30b3221

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 30b3221

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

supervisor/shared/filesystem.c

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

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

224228
return true;

0 commit comments

Comments
 (0)