From 1496ddba876a5b368c91ef8703288742bef8fb5e Mon Sep 17 00:00:00 2001 From: Daniel Hammer Date: Wed, 8 Jul 2026 11:57:52 +0200 Subject: [PATCH] fix: A2DP reconnect fix --- kernel/src/Api/BuildNo.hpp | 2 +- kernel/src/Drivers/USB/Bluetooth/A2dp.cpp | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/kernel/src/Api/BuildNo.hpp b/kernel/src/Api/BuildNo.hpp index e804708..46dfbd9 100644 --- a/kernel/src/Api/BuildNo.hpp +++ b/kernel/src/Api/BuildNo.hpp @@ -12,4 +12,4 @@ #pragma once -#define MONTAUK_BUILD_NUMBER 39 +#define MONTAUK_BUILD_NUMBER 42 diff --git a/kernel/src/Drivers/USB/Bluetooth/A2dp.cpp b/kernel/src/Drivers/USB/Bluetooth/A2dp.cpp index 6ef3464..1963a82 100644 --- a/kernel/src/Drivers/USB/Bluetooth/A2dp.cpp +++ b/kernel/src/Drivers/USB/Bluetooth/A2dp.cpp @@ -1258,7 +1258,11 @@ namespace Drivers::USB::Bluetooth::A2dp { rsp[3] = 6; rsp[4] = (MEDIA_AUDIO << 4); rsp[5] = CODEC_SBC; - rsp[6] = 0x21; // 44.1kHz | Joint Stereo + rsp[6] = 0x11; // 48kHz | Joint Stereo -- MUST match the + // encoder (fixed 48kHz) and our own + // SetConfig (oct0=0x11); advertising 44.1 + // here let a remote-initiated config pick a + // rate we then don't actually send rsp[7] = 0x15; // 16 blocks (b4) | 8 subbands (b2) | Loudness (b0) rsp[8] = 2; // Min bitpool rsp[9] = 53; // Max bitpool @@ -1267,9 +1271,12 @@ namespace Drivers::USB::Bluetooth::A2dp { } case AVDTP_SET_CONFIGURATION: { - // Accept configuration from remote + // Accept configuration from remote. Payload after the + // 2-byte header: [ACP SEID (ours)][INT SEID (theirs)] -- + // record THEIRS; our later START must address the sink's + // SEID or it rejects with BAD_ACP_SEID (0x12). if (len >= 4) { - g_remoteSeid = (data[2] >> 2) & 0x3F; + g_remoteSeid = (data[3] >> 2) & 0x3F; g_state = State::Configured; SendAvdtpResponse(txLabel, AVDTP_SET_CONFIGURATION, nullptr, 0); KernelLogStream(OK, "BT-A2DP") << "Remote configured stream, SEID="