From 44d5c9e2cf9f1ce0670be5bedd1e415cd5c3e739 Mon Sep 17 00:00:00 2001 From: kleidione Freitas Date: Thu, 24 Mar 2022 09:16:43 -0300 Subject: veux: Merge common tree to veux - Ref: https://github.com/xiaomi-sm6375-devs/android_device_xiaomi_sm6375-common Signed-off-by: kleidione --- rootdir/bin/init.mi.btmac.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 rootdir/bin/init.mi.btmac.sh (limited to 'rootdir/bin/init.mi.btmac.sh') diff --git a/rootdir/bin/init.mi.btmac.sh b/rootdir/bin/init.mi.btmac.sh new file mode 100755 index 0000000..66ec4b2 --- /dev/null +++ b/rootdir/bin/init.mi.btmac.sh @@ -0,0 +1,21 @@ +#!/vendor/bin/sh +# Copyright (C) 2021 KudProject Development +# SPDX-License-Identifier: GPL-3.0-or-later OR Apache-2.0 + +LOG_TAG="MiSetBtMac" +logi () { log -t "$LOG_TAG" -p i "$@"; } + +# hex binary containing mac address +BT_MAC_HEX_PATH="/data/vendor/mac_addr/bt.mac"; +if [ ! -f "$BT_MAC_HEX_PATH" ]; then + logi "bt.mac file not found, exiting" + exit +fi + +# raw mac address without colons +RAW_MAC=$(xxd -p "$BT_MAC_HEX_PATH"); +# convert it into format recognized by bluetooth hal +DEC_MAC=$(echo "$RAW_MAC" | sed 's!^M$!!;s!\-!!g;s!\.!!g;s!\(..\)!\1:!g;s!:$!!') +# set the mac address using persist property +setprop persist.vendor.service.bdroid.bdaddr "$DEC_MAC" +logi "bt.mac file found, setting mac addr" -- cgit v1.2.3