Skip to content

Native installer reads the macOS 27 speaker tuning; camera and AMKOR Bluetooth extraction - #101

Merged
RyanTheTide merged 3 commits into
mainfrom
fix/native-audio-tuning-macos27
Nov 5, 2026
Merged

RyanTheTide merged 3 commits into
mainfrom
fix/native-audio-tuning-macos27

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Native installer: macOS 27 speaker tuning

NativeAudioTuningInputs read only the shared Tunings/DeviceDSPDatabase.plist. macOS 27 doesn't have that file, so a fresh native install on macOS 27 left the speaker tuning out. It now chooses the database the same way the Python collector has since #100:

  • It reads AID<n>/DSP/DSPDatabase.plist when the folder has one, and the shared database otherwise.
  • If the folder database holds exactly the AID<n> key, it goes into the bundle as DeviceDSPDatabase.plist byte for byte. Anything else is reduced to that key. Mode names are not normalised.
  • It follows the speaker modes' Path references:
    • references under AID<n>/ must be in the folder;
    • references under Common/ become shared_files;
    • any other reference fails the collection, and so do a traversal, a link or a missing file.
  • DRC/loudness-manager.plist is collected only when it lists this AID.
  • The manifest gains device_dsp_database_source, shared_files and loudness_manager, the same records the Python writer emits. The schema stays at 2. When there is no loudness manager, the key is left out instead of being written as null, the same way speaker_id is already handled.

The tests in NativeAudioTuningLayoutTests use synthetic trees shaped like both layouts. No Apple data is involved.

Extraction gaps found by rebuilding the J616s vendorfw from its own macOS

Ryan asked that the J616s's hand-built vendorfw/ be replaced with the output of the installer's own extraction. I booted macOS 27 (26A428) once with asahi-bless --next and ran the asahi_firmware collections there, in the layout StubInstaller.collect_firmware writes. Then I rebuilt vendorfw on Linux with update_firmware and compared it with the hand-built set by path and hash. Two gaps showed up, and both are fixed here:

  • Camera: the extractors had no entry for isp_2224_01XX.dat (IMX958), and the H16 daemon now lives in usr/libexec. The fix is the commit from draft firmware: extract H17 camera tuning from current daemon locations #71, rebased onto main, with a conflict in stub.py resolved so that the camera daemons and audio-tuning/ both go into the fallback archive.
  • Bluetooth: the Python collector had no vendor mapping for AMKOR, so it dropped every AMKOR module's .bin/.ptb. brcmbt4388c2-apple,hostomel-a.* was missing. It now maps AMKOR to a, as BroadcomFirmware.bluetooth already does. New test: tests/test_bluetooth.py.

The other differences from the hand-built set are expected, not gaps:

  • The macOS 27 Wi-Fi and Bluetooth firmware is newer.
  • The hostomel-{ID,X0,X2,X3} Wi-Fi names collapse into the board-wide name, because macOS 27's per-SKU files are identical. Both collectors prune the same way, and brcmfmac falls back to the board name.
  • avd-fw-v5-t1.bin is open firmware. The kernel package ships it in /usr/lib/firmware/updates/<release>/, and that copy takes precedence anyway.

Tests

  • Swift (Xcode 26 toolchain): swift test --filter 'NativeAudioTuning|NativeInstallationFinishingTests|NeoFirmwareConversionTests' ran 38 tests, 0 failures. swift-format lint --strict is clean on the changed files.
  • Python: pytest tests gave 78 passed.

Hardware (J616s, fleet16)

  • The ESP now has asahi/ (with all_firmware.tar.gz and the kernelcache) and a vendorfw/ rebuilt by update_firmware. The hand-built vendorfw was backed up first and swapped out with RENAME_EXCHANGE.
  • After the reboot:
    • Wi-Fi associated on the new firmware.
    • Bluetooth is powered and scanning.
    • The camera streamed 30 frames.
    • The unpacked vendorfw matches the ESP.
    • install-linux.sh --verify found the AID35 bundle complete and matching the ESP, with 0 SELinux denials.
  • install-linux.sh --dry-run with the collected tarball reports "identical".

🤖 Generated with Claude Code

RyanTheTide and others added 3 commits November 5, 2026 16:39
Add the IMX958 2224 setfile and the H17 IMX558 1925 setfile to the
legacy extractor, and register 2224 in the native converter. Search both
usr/sbin and usr/libexec for h13/h16 camera daemons and retain their
flattened fallback inputs for device-local firmware updates.

Copy only each setfile's published source length, then zero its alignment
padding. This avoids reading the object after J700's short 1925 file.
Reject conflicting inputs and cover extraction, truncation, padding and
archive interoperability with synthetic data. Document that the existing
raw factory archive preserves iCCl but the ISP upload ABI remains unknown.

Setfile identities and lengths are public driver interoperability facts;
no vendor or per-module calibration bytes are included.

Assisted-by: LLM
Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
macOS 27 has no shared Tunings/DeviceDSPDatabase.plist. Each Mac's entry
is in AID<n>/DSP/DSPDatabase.plist, so a fresh native install on macOS 27
left the speaker tuning out.

NativeAudioTuningInputs now selects the database as the Python collector
has since #100: the folder's own DSPDatabase.plist when it exists, the
shared database otherwise. A folder database that holds exactly the
AID<n> key goes into the bundle as DeviceDSPDatabase.plist byte for byte;
anything else is reduced to that key. Mode names are not normalised.

The built-in speaker modes' Path references are followed: references
under AID<n>/ must be in the folder, references under Common/ are
collected as shared files, and anything else, a traversal, a link or a
missing file fails the collection. DRC/loudness-manager.plist is
collected only when it lists this AID. The manifest gains the same
device_dsp_database_source, shared_files and loudness_manager records
the Python writer emits; schema stays 2.

Tests build synthetic Tunings trees shaped like both layouts.

Assisted-by: LLM
Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
M4 Pro and M4 Max Macs carry a BCM4388C2 from AMKOR or USI. The Python
collector knew only MUR, USI and GEN, so it warned "Unable to determine
vendor" and dropped every AMKOR .bin and .ptb, and a Mac with an AMKOR
module got no Bluetooth firmware from asahi_firmware.update. The native
collector already maps AMKOR to "a". Map it the same way.

Found rebuilding the J616s vendorfw from its own macOS 27 firmware: the
hand-assembled set had brcmbt4388c2-apple,hostomel-a.{bin,ptb} and the
Python rebuild did not.

Assisted-by: LLM
Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RyanTheTide
RyanTheTide merged commit d69cb06 into main Nov 5, 2026
3 checks passed
@RyanTheTide
RyanTheTide deleted the fix/native-audio-tuning-macos27 branch November 5, 2026 06:04
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.

1 participant