fw/services: offer music to every phone without a media service - #1989
Open
zunda-pixel wants to merge 1 commit into
Open
fw/services: offer music to every phone without a media service#1989zunda-pixel wants to merge 1 commit into
zunda-pixel wants to merge 1 commit into
Conversation
The music endpoint only claimed the music server when the phone said Android, so a desktop companion got nothing: neither this endpoint, because of the check, nor the Apple Media Service, because it does not publish one. The OS it declares has been a first-class value for as long as the enum has had RemoteOSX, RemoteOSLinux and RemoteOSWindows in it. iOS is the one that has somewhere else to read from, and AMS is not gated on the declared OS at all — it connects when its GATT service is found, and whichever side claims music_set_connected_server last wins. So the condition wants to be about who has an alternative rather than about Android: iOS keeps AMS, an app that does not say what it runs on is left alone in case it is an older iOS one, and everything else gets the endpoint. Covered both ways: a desktop app is now asked for its state on connect, and one that declares nothing still is not. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: zunda pixel <zunda.dev@gmail.com>
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.
music_endpoint_handle_mobile_app_info_eventclaims the music server only when the phone says Android, so a desktop companion app gets nothing at all: not this endpoint, because of the check, and not the Apple Media Service, because it does not publish one.s_connectedstays false andmusic_protocol_msg_callbackreturns at its first line, so commands andNowPlayingwrites are both dropped.The OS the phone declares has been a first-class value for as long as
RemoteOShas hadRemoteOSX,RemoteOSLinuxandRemoteOSWindowsin it, and none of the three is reachable today.Why the condition wants to be about alternatives
iOS is the one platform with somewhere else to read music from, and AMS is not gated on the declared OS at all —
RemoteOSiOSappears in no.cfile undersrc/fw. AMS connects when its GATT service is discovered, and whichever side callsmusic_set_connected_serverlast wins; that is exactly why this function callsams_music_disconnect()before claiming it.So the check becomes: iOS keeps AMS, an app that declares nothing is left alone in case it is an older iOS one, and everything else — a desktop, or Android — gets the endpoint it has no substitute for.
Verified in QEMU, both ways
Built
qemu_emerytwice offmaster, differing only in this hunk, and connected the same client to each. The client declares macOS in itsPhoneVersionresponse, and the observable is unprompted: the firmware asks a phone it will talk music to for its state, so a frame on endpoint 32 arriving by itself is the answer.16×132×108—MusicEndpointCmdIDGetAllInfomaster16×1Tests
Two cases in
test_music_endpoint, next to the iOS one that is already there:request_now_playing_from_desktop_app—RemoteOSXconnects, state is requestedignore_now_playing_from_app_of_unknown_os—RemoteOSUnknownconnects, nothing is handledReverting the hunk fails
request_now_playing_from_desktop_appand only that one, so the pair pins the change and the boundary it keeps.The existing helper still takes its
bool is_android, so the other fifteen call sites are untouched; the new tests use anos-taking one it now delegates to.test_music_asterix/obelix/gabbrofail in my tree on image comparisons, which is my-DPBL_TEST_IMAGES=OFFconfiguration — those binaries do not linkmusic_endpoint_handle_mobile_app_info_eventat all, so this cannot reach them.On hardware, a Mac leaves the watch with nothing
I could not try the patched firmware on a watch, but I could try what a Mac gets without it. A Pebble Time 2 on v4.36.2, connected to a macOS companion over PPoG, with music playing on the Mac:
The watch's music app stayed empty through both sessions, the second one after a fresh boot, so it is not a stale discovery. So whatever macOS does or does not publish, the watch ends up with no music source at all: not this endpoint, because of the check, and not another one either.
I still have not inspected macOS's GATT database, so I am not claiming it publishes no AMS — only that a watch talking to a Mac gets nothing, which is the gap this closes. If it turns out macOS does publish one,
ams_music_disconnect()hands music to the endpoint, which is what a desktop companion wants anyway: it can drive the machine's own player.Found while writing an independent Swift companion for iOS and macOS, where the macOS build has no way to control music. Written with AI assistance; the QEMU comparison and the test runs above are mine and reproducible.