Revert "utils: bdaddr: skip setting bdaddr for 5.4 kernel version"
This reverts commit a565a8f7a8e75420ba94de07ecec055da35b0afe.
Reason for revert:
it's just a workaround, proper solution should have the set_bdaddr
service started after the necessary firmwares loaded.
Bug: 318404233
Fixes: f70f12a826af("utils: bdaddr: Add service to set Bluetooth device (MAC) address")
Test: bluetooth turned on by default for all kernel versions
Change-Id: Ifc1a0bcce17c1d382cce9ce7f79fec1ac5d40ad7
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
diff --git a/sepolicy/set_bdaddr.te b/sepolicy/set_bdaddr.te
index 1540d47..c7fa166 100644
--- a/sepolicy/set_bdaddr.te
+++ b/sepolicy/set_bdaddr.te
@@ -4,7 +4,6 @@
# audit2allow
allow set_bdaddr proc_cmdline:file { open read };
-allow set_bdaddr proc_version:file { open read getattr };
allow set_bdaddr proc_bootconfig:file { open read };
allow set_bdaddr rootfs:dir { open read };
allow set_bdaddr self:bluetooth_socket { bind create read write };
diff --git a/shared/utils/bdaddr/set_bdaddr.sh b/shared/utils/bdaddr/set_bdaddr.sh
index 2e4ff48..e59fa39 100644
--- a/shared/utils/bdaddr/set_bdaddr.sh
+++ b/shared/utils/bdaddr/set_bdaddr.sh
@@ -26,19 +26,6 @@
# Format the output in xx:xx:xx:xx:xx:xx format for the
# "bdaddr" command to work.
-if /vendor/bin/grep -o 'Linux version 5.4.' /proc/version; then
- # for 5.4 kernels, setting the bdaddr would cause
- # bluetooth::StackManager::StartUp crash like reported here:
- # https://issuetracker.google.com/issues/318404233
- # so skipping it here.
- # It's possible to not integrate this script at building time,
- # but that way would make 5.4 and other kernel versions use different
- # super.img files, for development convenience doing the check
- # at runtime here, so that only boot.img/vendor_boot.img are
- # necessary for different versions
- exit 0
-fi
-
BTADDR=`/vendor/bin/cat /proc/cmdline | /vendor/bin/grep -o serialno.* |\
/vendor/bin/cut -f2 -d'=' | /vendor/bin/awk '{printf("c0%010s\n", $1)}' |\
/vendor/bin/sed 's/\(..\)/\1:/g' | /vendor/bin/sed '$s/:$//'`