Skip to content

macOS: read diskutil's WholeDisk key so cards are listed again - #1

Merged
itskenny0 merged 1 commit into
andr36oid:mainfrom
sayobaid:fix-macos-wholedisk-key
Nov 8, 2026
Merged

itskenny0 merged 1 commit into
andr36oid:mainfrom
sayobaid:fix-macos-wholedisk-key

Conversation

@sayobaid

@sayobaid sayobaid commented Nov 4, 2026

Copy link
Copy Markdown

Problem

On macOS the flasher shows "No removable cards found" even though the card is
inserted and macOS sees it (diskutil list shows it as external, physical).
Turning on "Show all drives (advanced)" does not help either.

Cause

list() in internal/platform/device_darwin.go decides whether a disk is a whole
disk with:

whole, _ := inf["Whole"].(bool)

diskutil info -plist doesn't print a Whole key. The key is WholeDisk. Because
Whole is missing, whole is always false, so the !whole check skips every
disk, with or without ListAll.

diskutil info -plist on the affected card (macOS 26.6.2):

Internal = False                       Ejectable = True
RemovableMediaOrExternalDevice = True  Writable = True
WholeDisk = True                       Whole = <missing>
DeviceBlockSize = 512                  BusProtocol = USB

Fix

  • Read WholeDisk through a small wholeDisk() helper.
  • Fall back to Whole in case any macOS version prints it.
  • Add TestWholeDisk for 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 vet passes 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) and list(true) directly, alternating between
    main and this branch with the card inserted:

    list(false) list(true)
    main (empty) (empty)
    this branch Storage Device · 62.5 GB · /dev/disk4 Storage Device · 62.5 GB · /dev/disk4

    The 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.

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.
@itskenny0

itskenny0 commented Nov 8, 2026 •

Copy link
Copy Markdown
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!

@itskenny0
itskenny0 merged commit cb42697 into andr36oid:main Nov 8, 2026
@sayobaid

Copy link
Copy Markdown
Author

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!

No problem!

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