Skip to content

Commit

Permalink
Bluetooth: Add a workaround for M_RELEASE rsp len in ble_gap.cc
Browse files Browse the repository at this point in the history
Some devices ship with Bluetooth firmware that advertises
compliance with Android M's capabilities but fails certain
requirements such as the minimum expected response length.

This commit introduces an if-else block that allows those devices
to set a system property to bypass that check, fixing Bluetooth in
cases where this check is the only thing impeding it from working.

Change-Id: Ibbf81e922fe75bf0ef5b8cd7197c812348063db5
  • Loading branch information
AShiningRay authored and Stricted committed Feb 9, 2024
1 parent fc82283 commit 1fbadd6
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion system/stack/btm/btm_ble_gap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <base/functional/bind.h>
#include <base/logging.h>
#include <base/strings/string_number_conversions.h>
#include <cutils/properties.h>

#include <cstdint>
#include <list>
Expand Down Expand Up @@ -710,8 +711,19 @@ static void btm_ble_vendor_capability_vsc_cmpl_cback(

if (btm_cb.cmn_ble_vsc_cb.version_supported >=
BTM_VSC_CHIP_CAPABILITY_M_VERSION) {
CHECK(p_vcs_cplt_params->param_len >=

/*
* If the device has a BT firmware that advertises compliance with Marshmallow
* LE capabilities but fails to pass the minimum expected response length, skip
* checking its reported response length against the minimum expected by M_RELEASE
* if said device is known to have Bluetooth working again by simply skipping past
* this, and has the respective system property set.
*/
if(!property_get_bool("bluetooth.device.m_rsplen_workaround", false)) {
CHECK(p_vcs_cplt_params->param_len >=
BTM_VSC_CHIP_CAPABILITY_RSP_LEN_M_RELEASE);
}

STREAM_TO_UINT16(btm_cb.cmn_ble_vsc_cb.total_trackable_advertisers, p);
STREAM_TO_UINT8(btm_cb.cmn_ble_vsc_cb.extended_scan_support, p);
STREAM_TO_UINT8(btm_cb.cmn_ble_vsc_cb.debug_logging_supported, p);
Expand Down

0 comments on commit 1fbadd6

Please sign in to comment.