Repository navigation
macOS: read diskutil's WholeDisk key so cards are listed again - #1
Merged
Merged
Conversation
diskutil info -plist reports whether a disk is a whole disk as
"WholeDisk". list() read a "Whole" key that diskutil does not print,
so every disk was taken for a partition and skipped: the card list
stayed empty ("No removable cards found"), with "Show all drives"
too. Read WholeDisk, keep Whole as a fallback, and test both.
Member
|
Sorry it took me a long time to see this - my mac is out of commission, so I can't test this atm, but I will fold it into the next release! Thank you for your contribution! |
Author
No problem! |
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.
Problem
On macOS the flasher shows "No removable cards found" even though the card is
inserted and macOS sees it (
diskutil listshows it asexternal, physical).Turning on "Show all drives (advanced)" does not help either.
Cause
list()ininternal/platform/device_darwin.godecides whether a disk is a wholedisk with:
diskutil info -plistdoesn't print aWholekey. The key isWholeDisk. BecauseWholeis missing,wholeis alwaysfalse, so the!wholecheck skips everydisk, with or without
ListAll.diskutil info -pliston the affected card (macOS 26.6.2):Fix
WholeDiskthrough a smallwholeDisk()helper.Wholein case any macOS version prints it.TestWholeDiskfor whole disk, partition, legacy key and missing key.No other behaviour changes. The other filters (system-disk protection, fixed vs
removable, writable) are untouched.
Testing
go test ./internal/platform/passes.go vetpasses for darwin, windows and linux.I tested on real hardware: macOS 26.6.2 on Apple Silicon, 64 GB microSD in a USB
card reader. I called
list(false)andlist(true)directly, alternating betweenmainand this branch with the card inserted:list(false)list(true)mainStorage Device · 62.5 GB · /dev/disk4Storage Device · 62.5 GB · /dev/disk4The system SSD (
disk0) is still not listed.I haven't run a full flash with the patched app. This change only affects which
disks are listed.