Fix BT on apollo/thor

Closes https://github.com/Divested-Mobile/DivestOS-Build/issues/16

Signed-off-by: Tad <tad@spotco.us>
This commit is contained in:
Tad 2021-10-06 04:52:13 -04:00
parent 59bd09a807
commit e4a4e7f8de
3 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,47 @@
From f7fceea92ea8d1ac0ea8164d35a42721ad27aa98 Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Wed, 6 Oct 2021 04:49:33 -0400
Subject: [PATCH] Add an option to disable the assert added in fc2ca9ee
To prevent breaking Bluetooth on devices that lack such command.
Signed-off-by: Tad <tad@spotco.us>
Change-Id: If4853d441bdf5ad728c8637a56c8ec7785794dda
---
Android.mk | 4 ++++
device/src/controller.c | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/Android.mk b/Android.mk
index b370cc06f..3fff6aa16 100644
--- a/Android.mk
+++ b/Android.mk
@@ -21,6 +21,10 @@ ifeq ($(TARGET_BUILD_VARIANT),eng)
bluetooth_CFLAGS += -DBLUEDROID_DEBUG
endif
+ifeq ($(TARGET_BLUETOOTH_NO_READENCRKEYSIZE),true)
+bluetooth_CFLAGS += -DNO_READENCRKEYSIZE
+endif
+
bluetooth_CFLAGS += -DUSE_AUDIO_TRACK
bluetooth_CFLAGS += -DEXPORT_SYMBOL="__attribute__((visibility(\"default\")))"
diff --git a/device/src/controller.c b/device/src/controller.c
index 60820c2c0..89963dc30 100644
--- a/device/src/controller.c
+++ b/device/src/controller.c
@@ -293,8 +293,9 @@ static future_t *start_up(void) {
response,
&number_of_local_supported_codecs, local_supported_codecs);
}
-
+#ifndef NO_READENCRKEYSIZE
assert(HCI_READ_ENCR_KEY_SIZE_SUPPORTED(supported_commands));
+#endif
readable = true;
return future_new_immediate(FUTURE_SUCCESS);
--
2.31.1

View File

@ -98,6 +98,7 @@ patchWorkspace() {
repopick -it n-asb-2021-08; repopick -it n-asb-2021-08;
repopick -i 315718; #CVE-2021-1957 repopick -i 315718; #CVE-2021-1957
repopick -it n-asb-2021-09; repopick -it n-asb-2021-09;
repopick -it n-asb-2021-10;
source "$DOS_SCRIPTS/Patch.sh"; source "$DOS_SCRIPTS/Patch.sh";
source "$DOS_SCRIPTS_COMMON/Copy_Keys.sh"; source "$DOS_SCRIPTS_COMMON/Copy_Keys.sh";

View File

@ -255,6 +255,7 @@ if enterAndClear "system/bt"; then
patch -p1 < "$DOS_PATCHES/android_system_bt/229574.patch"; #Increase maximum Bluetooth SBC codec bitrate for SBC HD patch -p1 < "$DOS_PATCHES/android_system_bt/229574.patch"; #Increase maximum Bluetooth SBC codec bitrate for SBC HD
patch -p1 < "$DOS_PATCHES/android_system_bt/229575.patch"; #Explicit SBC Dual Channel (SBC HD) support patch -p1 < "$DOS_PATCHES/android_system_bt/229575.patch"; #Explicit SBC Dual Channel (SBC HD) support
patch -p1 < "$DOS_PATCHES/android_system_bt/242134.patch"; #avrc_bld_get_attrs_rsp - fix attribute length position off by one patch -p1 < "$DOS_PATCHES/android_system_bt/242134.patch"; #avrc_bld_get_attrs_rsp - fix attribute length position off by one
patch -p1 < "$DOS_PATCHES/android_system_bt/0001-NO_READENCRKEYSIZE.patch"; #Add an option to let devices opt-out of the HCI_READ_ENCR_KEY_SIZE_SUPPORTED assert
fi; fi;
if enterAndClear "system/core"; then if enterAndClear "system/core"; then
@ -312,6 +313,7 @@ fi;
#START OF DEVICE CHANGES #START OF DEVICE CHANGES
# #
if enterAndClear "device/amazon/hdx-common"; then if enterAndClear "device/amazon/hdx-common"; then
echo "TARGET_BLUETOOTH_NO_READENCRKEYSIZE := true" >> BoardConfigCommon.mk; #Fix BT crash
sed -i 's/,encryptable=footer//' rootdir/etc/fstab.qcom; #Using footer will break the bootloader, it might work with /misc enabled sed -i 's/,encryptable=footer//' rootdir/etc/fstab.qcom; #Using footer will break the bootloader, it might work with /misc enabled
#XXX: If not used with a supported recovery, it'll be thrown into a bootloop, don't worry just 'fastboot erase misc' and reboot #XXX: If not used with a supported recovery, it'll be thrown into a bootloop, don't worry just 'fastboot erase misc' and reboot
#echo "/dev/block/platform/msm_sdcc.1/by-name/misc /misc emmc defaults defaults" >> rootdir/etc/fstab.qcom; #Add the misc (mmcblk0p5) partition for recovery flags #echo "/dev/block/platform/msm_sdcc.1/by-name/misc /misc emmc defaults defaults" >> rootdir/etc/fstab.qcom; #Add the misc (mmcblk0p5) partition for recovery flags