Skip to content

Support for V1/Legacy devices such as XM3s and XM4s - #56

Open
mos9527 wants to merge 300 commits into
rewritefrom
v1-compat
Open

mos9527 wants to merge 300 commits into
rewritefrom
v1-compat

Conversation

@mos9527

@mos9527 mos9527 commented Aug 3, 2026 •

Copy link
Copy Markdown
Owner

NOTE: Do not be alarmed by the LoC changes. Most of which are generated code for the legacy protocol.

This PR also introduces fully auto-generated protocol definition for V1/V2 themselves through IDA. Courtesy of GPT 5.6 Sol for writing those scripts.

Test suites for packet playback are added too to validate the packets themselves. This should work for both protocol versions.

Be patient as this will take quite a while to land as I don't have devices to test myself. Though if anyone's willing to test, get your nightly builds on this branch here:

Linking to issues that requested support before:

Referencing implementation for XM3/XM4s by:

CC @Amrsatrio. I think we can prepare a proper v2.0 release once this is done.


Also coming up:

  • Debugger panel for packet introspection. You can make and send arbitrary ones here too.
    Compile with CMake option -DMDR_CLIENT_DEBUGGER when building the client to have this available in the top-left drop down menu.
image image

@mos9527
mos9527 force-pushed the v1-compat branch 2 times, most recently from 4b22e78 to 63ef711 Compare August 5, 2026 05:56
@geekifier

geekifier commented Aug 17, 2026 •

Copy link
Copy Markdown

I tried testing the nightly for macOS, but it seems like it doesn't work with Sequoia. Is Tahoe or later required to use the Mac build?

You can’t use this version of the application “SonyHeadphonesClient.app” with this version of macOS.

mos9527 added a commit that referenced this pull request Aug 18, 2026
@mos9527

mos9527 commented Aug 18, 2026

Copy link
Copy Markdown
Owner Author

@geekifier ae71d32 should solve this, please get the new builds from nightly. I guess Actions updated their macOS runner to Tahoe which defaulted to be the macOS build targets.

Verified on my own Mac Mini running on Sequoia 15.7.8.

@geekifier

Copy link
Copy Markdown

Confirmed the updated nightly build opens on macOS 15 / Sequoia.

jkolo and others added 4 commits August 21, 2026 01:47
Sound Connect's "Fixing playback device" pins audio to the current playback
device so the headphones stop handing it over to the other multipoint device.

SOURCE_SWITCH_CONTROL's param byte carries this, inverted against the feature:
the wire value is 1 while switching is free and 0 once the device is fixed.
Verified on WF-1000XM5 (fw 6.1.0) by toggling the setting in Sound Connect and
reading the byte back, then driving it the other way and confirming the padlock
appears in the official app.

SourceSwitchControlResult is surfaced too - the headphones refuse to fix while a
call is in progress or the voice assistant holds priority, which Sound Connect
reports as a dialog and would otherwise look like a dead button. The added rx
packets are a real capture of the not-fixed state and of a FAIL_CALLING refusal.

mdrHeadphonesGetFeature's upper bound was pinned to the last feature id, so any
newly added MDR_FEATURE_* read back as invalid.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKt3Lk68pt5yr92YV1iTqn
…rsion

Rebased onto the current MDRProperty API (pending()/override() replace
submittedDirty()/commitOneShot(), renamed underneath this branch), and
renamed the public surface as requested in review: MDR_FEATURE_PLAYBACK_DEVICE_FIX
becomes MDR_FEATURE_SOURCE_SWITCH_CONTROL, mdrHeadphonesGet/SetPlaybackDeviceFixed
becomes mdrHeadphonesGet/SetSourceSwitchControl, MDRPlaybackFixResult becomes
MDRSourceSwitchControlResult - matching SOURCE_SWITCH_CONTROL and the packet
debugger instead of translating Sound Connect's Japanese-derived label.

libmdr now tracks the wire value directly (1 = switching free) instead of
mangling it into a "fixed" flag; the one inversion left lives in Client.cpp,
where "Fixing playback device" is a UI concept. Also dropped two MDR_LOG_DEBUG
calls in the SOURCE_SWITCH_CONTROL notify/param handlers, matching the other
protocol handlers, which don't log there either.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qy2qqZHg5iaikSzDSNMT9o
Fix playback device on multipoint
@Protected

Copy link
Copy Markdown

Hello. This isn't working for me on CachyOS linux:

[Client] Connection: Connecting to remote device
[Client] Headphones: Unable to serialize command (Malformed payload)

Would you like me to send you more data? How can I do this?

@mos9527

mos9527 commented Aug 27, 2026

Copy link
Copy Markdown
Owner Author

Hello. This isn't working for me on CachyOS linux:

[Client] Connection: Connecting to remote device
[Client] Headphones: Unable to serialize command (Malformed payload)

Would you like me to send you more data? How can I do this?

Provide model info and with any luck, try again while we wait for this PR to land, which can possibly fix this:

@Protected

Copy link
Copy Markdown

Wow, sorry, I didn't notice I had neglected to include the model. It's the XM4. If you don't need any tests from me I'm happy to wait for the pull request.

@mos9527

mos9527 commented Aug 27, 2026

Copy link
Copy Markdown
Owner Author

Wow, sorry, I didn't notice I had neglected to include the model. It's the XM4. If you don't need any tests from me I'm happy to wait for the pull request.

XM4s are barely tested as of now, and roviding packet captures in its current state can be difficult.

For your convenience I'd say wait for that( and this entire) PR first, if anything. Me and @Amrsatrio will update on this too if we made any progress on real HWs.

Fix debug packet logs
mos9527 and others added 30 commits October 26, 2026 13:13
The race condition is as follows:
- 1. DEVICE sends RET/NTFY that HOST does not expect (w/o a corresponding GET), this is cached due to #64
- 2. HOST state machine runs
- 3. HOST sends a GET, Await() for a RET, but due to 1. the state machine is immediately resumed
- 4. The actual ACK, or RET will wake the next Await() and thus causing the signal to leak

We needed to cache the RET/ACK due to how devices may respond out-of-order. We do NOT, however, to cache them when we don't even have a GET yet.

This commits therefore makes `Awaiter`s counted by packet no. , effectively discarding Awakes when no one is actually, *awaiting*.

The new macro, `SendCommandAwaitResult` is introduced to handle this case.

Furthermore, this commit also removed all pre-exisiting (which are client Debugger only) `Details.hpp` usage outside `libmdr` itself, and are now provided via ABI per `mdrDebug...` APIs.

Tests contributed by GPT-6-Astra
Allows build without a Bluetooth backend implemented. This is mostly meant for porting efforts.
Bad `numberOfErrorCode` prefix for an already prefixed `MDRPodArray`

Contribution by Claude-Opus-5.5
This commit makes it so that it's *impossible* to request Listening Mode changes when Voice Control, etc, is enabled. This matches Sound Connect's intended behaviour.

Furthermore, support for controlling Voice Assistant settings is also introduced. Thanks @brawaru for the heads up!

Co-Authored-By: Amr Satrio <20662640+Amrsatrio@users.noreply.github.com>
Require sources to have a `clang-format` pass
We used to hardcode a lot of the devices' advertised cap ranges (e.g. playback vol range, etc.).

Note that while it have worked we don't have to *guess* that. Considering the packet layouts actually contain most of the info!

This commits adds `mdrHeadphonesGetValue`, which exposes `MDR_VALUE_...` keys for them to be queried.

e.g. Equalizier bands are no longer hardcoded to 5/10 bands, and ranges can change per device (though not observed for now).

Furthermore, this commit also fixes extractor for `EqBandInformation` and V1 battery levels. This contribution is assited by Claude-Opus-5.5.
Implement mdrHeadphonesGetValue for device limit queries
…ger instead

And with it, no more *implementation detail* leaks. TODO offer option for Client to use shared lib as well.
Clip via `ImGuiListClipper` first. Implementation by Claude-Opus-5.5
This is stupidly convoluted. And please let it be known that we are most definitely not a *clone* of Sound Connect.
That happens a lot since we were telling Emscripten to poll with `0` fps, which when tabbed-out stops the polling loop entirely.

This commits makes it so that:
- Web client runs at a min 40FPS and always polls
- Clean up for the entire `libmdr-bt` Web implementation (this used to be written by hand only...)

NOTE: You can use `Module.mdrSerialDebug = true` in console for debug info there now as well.
… Client

Originally implemented by @Amrsatrio *all* the way back in 03a18fd, which got accidentally left out of the UI during the rewrite.

This commit implements the controls for it. Furthermore GS string summary is also restored.

Another one being the slider steps, should've been implemented in UI by #78, but oh well - better late than never.
…FCOMM-over-COM-ports on Windows

Script contributed by Claude-Opus-5.5. Good bot, I didn't know that's possible

This commit also cleans up the `tooling/` structure a bit. Thus LoC changes are mostly updated paths besides that script itself.

This branch was successfully deployed

1 active deployment
github-pages — c0594bd3 Deployed Nov 20, 2026 by mos9527 via Deploy Client to GitHub Pages #854
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants