Repository navigation
Fix macOS mount bug (#424) - #448
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
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.logwhile 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
diskutil verifyVolumefound no errors.