Device: Correct AirPods info fields and expand protocol coverage#542
Merged
Conversation
Adopts the Wireshark AAP dissector (pabloaul/apple-wireshark) as a third reference source alongside LibrePods and MagicPodsCore. Catalogues every known message type and control/setting ID, corrects DeviceInfo field labels, and adds sealed AapPacket hierarchy with Connect Response parsing. Case Info probe (Pro 3), Sleep event, and Dynamic End of Charge decoders are in place for future use.
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.
What changed
AirPods device info (the details shown in the device settings card) now surfaces more accurate fields than before:
Debug logs are more informative, which helps troubleshoot user reports: every AAP message that reaches the app is now labeled with its protocol name (e.g.
Stream State Info,Sleep Detection Update) instead of a bare hex opcode.Credits: added the apple-wireshark dissector by Pablo Aul to the Thank You and Licenses sections — this PR adopts its catalog as a third reverse-engineering reference alongside LibrePods and MagicPodsCore.
Technical Context
AapMessageType) and all 66 control IDs (AapControlId) from the Wireshark dissector as typed enums, replacing scatteredconst valintegers. Settings-freshness tracking (KNOWN_NON_SETTINGS_COMMANDS) expanded to every push-only opcode so the AAP quality boost inPodDevice.computeAapBoostkeeps working for catalogued-but-not-modeled messages.AapMessagegeneralised to a sealedAapPackethierarchy (Connect / ConnectResponse / Disconnect / DisconnectResponse / Message / Unknown). Previously the read loop parsed Connect Response frames as a Message withcommandType=0, misinterpreting thestatusfield — now parsed properly. Pro 1 (firmware 51.9.6) reports non-zero feature bits0xE251_0004_E1B1_0004here; Pro 2 USB-C and Pro 3 report all zeros.0x00— the previous NUL-splitter silently truncated the payload after segment 10 and mis-labeled segments 5-7). Cached state serialises via@SerialName("buildNumber")on the renamedmarketingVersionfield so upgrades don't drop cached values.AIRPODS_PRO3only; dispatched from the read loop after a successful Connect Response, bypasses the outbound command queue (not anAapCommand, not ear-gated, not counted as pending).SharedFlowuntil a consumer exists. Keeps the reference catalog complete without adding unused public surface.EqBandsrenamed toPmeConfig— the Wireshark dissector calls opcode 0x53 "PME Config" and all captured Pro 2 USB-C / Pro 3 payloads are all-zero. The debug-only EQ bar chart auto-hides on all-zero data rather than showing a flat chart that looks like a configured EQ.AapFramerintentionally left untouched. Its payload-length semantics don't match real captures, but it's not in the hot path (production uses L2CAP SEQPACKET which delivers one frame perread()), and fixing it is a separate concern from this PR's scope.Review checklist
./gradlew :app:testFossDebugUnitTestpasses — 1,020 tests, includes per-model golden capture tests (Pro 1 / Pro 2 USB-C / Pro 3) and a cache-migration test for thebuildNumber → marketingVersionrename.CachedDeviceStateMigrationTest).ConnectResponse OKlogs with features hex;DeviceInfoDump #173reportssegments=15;HID: service info tokens=[…]instead ofHID: unknown.SEND CaseInfoProbein logcat — should be absent on other models).EqBandsUI section stays hidden when PME Config is all-zero (debug-only card).