From 3a18052032c0b99e919ebbacad963d21d4e76542 Mon Sep 17 00:00:00 2001 From: Davide Garberi Date: Fri, 17 May 2019 19:16:39 +0200 Subject: msm8996-common: Update mac addresses paths * Switch to /persist for bt_mac to make so that it's kept even after a factory reset * Also update the path of wlan_mac.bin in wlan.sh to write to the real mount point instead of the bind one Change-Id: I250358484a8c8a8ef7f01941eea798c11d6ac4e7 --- rootdir/bin/init.bt.sh | 4 ++-- rootdir/bin/init.wlan.sh | 9 +++++---- sepolicy/qti_init_shell.te | 6 +++--- vendor_prop.mk | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/rootdir/bin/init.bt.sh b/rootdir/bin/init.bt.sh index 52d7f8f..b3281fa 100644 --- a/rootdir/bin/init.bt.sh +++ b/rootdir/bin/init.bt.sh @@ -18,7 +18,7 @@ # Set the proper hardware based BT mac address proc_bt="/proc/mac_bt" -bt_mac_path="/data/vendor/bluetooth/bdaddr" +bt_mac_path="/mnt/vendor/persist/bluetooth/bt_mac" if [[ $(xxd -p $proc_bt) == "000000000000" ]] || [[ $(xxd -p $proc_bt) == "666666666666" ]] || [[ ! -f $proc_bt ]]; then ran1=$(xxd -l 1 -p /dev/urandom) ran2=$(xxd -l 1 -p /dev/urandom) @@ -32,6 +32,6 @@ else bt_mac=$(xxd -p $proc_bt | tr '[:lower:]' '[:upper:]' | sed 's/.\{2\}/&:/g' | sed 's/.$//'); fi; -if [[ ! -f $bt_mac_path ]] || [[ $(cat $bt_mac_path) == "" ]] || [[ $(cat $bt_mac_path) == "000000000000" ]] || [ $(cat $bt_mac_path) == "666666666666" ]]; then +if [[ ! -f $bt_mac_path ]] || [[ $(cat $bt_mac_path) == "" ]] || [[ $(cat $bt_mac_path) == "000000000000" ]] || [[ $(cat $bt_mac_path) == "666666666666" ]]; then echo $bt_mac > $bt_mac_path fi; diff --git a/rootdir/bin/init.wlan.sh b/rootdir/bin/init.wlan.sh index 4f3eb7b..78e5358 100644 --- a/rootdir/bin/init.wlan.sh +++ b/rootdir/bin/init.wlan.sh @@ -18,7 +18,8 @@ # Set the proper hardware based wlan mac proc_wifi="/proc/mac_wifi" -wifi_mac_persist=$(cat /persist/wlan_mac.bin | grep Intf0MacAddress | sed 's/Intf0MacAddress=//') +wifi_mac_path="/mnt/vendor/persist/wlan_mac.bin" +wifi_mac_persist=$(cat $wifi_mac_path | grep Intf0MacAddress | sed 's/Intf0MacAddress=//') if [[ $(xxd -p $proc_wifi) == "000000000000" ]] || [[ $(xxd -p $proc_wifi) == "555555555555" ]] || [[ ! -f $proc_wifi ]]; then ran1=$(xxd -l 1 -p /dev/urandom) ran2=$(xxd -l 1 -p /dev/urandom) @@ -31,7 +32,7 @@ if [[ $(xxd -p $proc_wifi) == "000000000000" ]] || [[ $(xxd -p $proc_wifi) == "5 else wifi_mac=$(xxd -p $proc_wifi | tr '[:lower:]' '[:upper:]'); fi; -if [[ ! -f /persist/wlan_mac.bin ]] || [[ $(echo $wifi_mac_persist) == "000000000000" ]] || [[ $(echo $wifi_mac_persist) == "555555555555" ]]; then - echo "Intf0MacAddress=$wifi_mac" > /persist/wlan_mac.bin - echo "END" >> /persist/wlan_mac.bin +if [[ ! -f $wifi_mac_path ]] || [[ $(echo $wifi_mac_persist) == "000000000000" ]] || [[ $(echo $wifi_mac_persist) == "555555555555" ]]; then + echo "Intf0MacAddress=$wifi_mac" > $wifi_mac_path + echo "END" >> $wifi_mac_path fi; diff --git a/sepolicy/qti_init_shell.te b/sepolicy/qti_init_shell.te index dbdc893..56c35ba 100644 --- a/sepolicy/qti_init_shell.te +++ b/sepolicy/qti_init_shell.te @@ -5,9 +5,9 @@ allow qti_init_shell file_contexts_file:file { getattr open read }; allow qti_init_shell mnt_vendor_file:dir rw_dir_perms; allow qti_init_shell mnt_vendor_file:file create_file_perms; -# Allow qti_init_shell to write and read /data/vendor/bluetooth/bdaddr -allow qti_init_shell vendor_bt_data_file:dir { add_name create search write }; -allow qti_init_shell vendor_bt_data_file:file { create getattr open read write }; +# Allow qti_init_shell to write and read /mnt/vendor/persist/bluetooth/bt_mac +allow qti_init_shell persist_bluetooth_file:dir { add_name create search write }; +allow qti_init_shell persist_bluetooth_file:file { create getattr open read write }; # Allow qti_init_shell to read cmdline allow qti_init_shell proc_cmdline:file { getattr open read }; diff --git a/vendor_prop.mk b/vendor_prop.mk index cf1f711..ad6db40 100644 --- a/vendor_prop.mk +++ b/vendor_prop.mk @@ -46,7 +46,7 @@ PRODUCT_PROPERTY_OVERRIDES += \ ro.btconfig.vendor=qcom \ ro.btconfig.chip=QCA6164 \ ro.btconfig.dev=/dev/ttyHS0 \ - ro.vendor.bt.bdaddr_path=/data/vendor/bluetooth/bdaddr + ro.vendor.bt.bdaddr_path=/mnt/vendor/persist/bluetooth/bt_mac # Camera PRODUCT_PROPERTY_OVERRIDES += \ -- cgit v1.2.3