Skip to content

Fix macOS mount bug (#424) - #448

Merged
bmorcelli merged 1 commit into
bmorcelli:mainfrom
therezor:fix/msc-macos-mount
Oct 15, 2026
Merged

bmorcelli merged 1 commit into
bmorcelli:mainfrom
therezor:fix/msc-macos-mount

Conversation

@therezor

@therezor therezor commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Refs #424

USB mode now reads the SD card faster. The debug log no longer writes to the card while a computer is using it.

Before (main) After
macOS mount time 14.4 s 13.2 s
Reading a 16 MB file 537 KB/s about 630 KB/s

Tested on a Cardputer ADV, macOS 27.0.1, 62 GB SD card.

Why

macOS reads the whole FAT table before it mounts a card. If that takes too long, it gives up. That is what happened in #424, when the SD card ran at 4 MHz.

#439 and cd392f2 raised the SD clock, and main now mounts. But it is still close. After the card was unplugged without ejecting, macOS took about 30 s to check and mount it. The failed test in #424 gave up at about 24 s.

How

Faster reads. The computer asks for 8 sectors at a time. Launcher read them with 8 separate SD commands. Now it uses one command (CMD18).

Safer log. The debug log wrote to Launcher_error.log while the computer had the card open, which can corrupt the card. Now the log stays in RAM and is saved after USB mode ends.

Cost: +160 bytes flash, +1 KB RAM.

Tested

  • Builds for Cardputer, T-Deck and T-Dongle S3.
  • On a Cardputer ADV: mounted 3 times, and diskutil verifyVolume found no errors.
  • The log file is saved correctly after USB mode ends.
  • Not tested on other boards' hardware.

Read every whole sector of a READ10 chunk with one disk_read (CMD18)
instead of one command per sector. On a Cardputer ADV with macOS 27 this
takes a 16 MB read from 537 to 637 KB/s and the FSKit mount of a 62 GB
card from 14.4 s to 13.2 s.

Buffer MSC debug lines in RAM and write them to Launcher_error.log after
USB mode ends and the card is remounted, instead of appending to the FAT
volume while the host has it mounted.

Refs bmorcelli#424
@therezor therezor changed the title USB MSC: faster SD reads, keep the debug log off the card while mounted Fix macOS mount bug (#424) Oct 15, 2026
@bmorcelli
bmorcelli merged commit 09ffc59 into bmorcelli:main Oct 15, 2026
93 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants