Skip to content

Commit

Permalink
msm8996-common: Correct BT mac address with non zui blobs
Browse files Browse the repository at this point in the history
Change-Id: Ibc6eed2018314e79f3f18749cedd9852c82a8a66
  • Loading branch information
DD3Boh committed May 15, 2019
1 parent 89507d6 commit 5463eae
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 8 deletions.
2 changes: 1 addition & 1 deletion msm8996.mk
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ PRODUCT_PACKAGES += \
init.qcom.sh \
init.qcom.power.rc \
init.qcom.usb.rc \
init.wlan.sh \
init.mac.sh \
ueventd.qcom.rc

# ConfigPanel
Expand Down
4 changes: 2 additions & 2 deletions rootdir/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES)
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE := init.wlan.sh
LOCAL_MODULE := init.mac.sh
LOCAL_MODULE_TAGS := optional eng
LOCAL_MODULE_CLASS := ETC
LOCAL_SRC_FILES := bin/init.wlan.sh
LOCAL_SRC_FILES := bin/init.mac.sh
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES)
include $(BUILD_PREBUILT)

Expand Down
8 changes: 8 additions & 0 deletions rootdir/bin/init.wlan.sh → rootdir/bin/init.mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,11 @@ if [[ ! -f /persist/wlan_mac.bin ]] || [[ $(cat /persist/wlan_mac.bin | grep Int
echo "Intf0MacAddress=$wifi_mac
END" > /persist/wlan_mac.bin
fi;

# Set the proper hardware based BT mac address
bt_mac_path="/data/vendor/bluetooth/bdaddr"
bt_mac=$(getprop sys.bt.address);
if [[ ! -f $bt_mac_path ]] || [[ $(echo $bt_mac) != $(cat /data/vendor/bluetooth/bdaddr) ]]; then
echo $bt_mac > $bt_mac_path
fi;
setprop ro.vendor.bt.bdaddr_path $bt_mac_path
13 changes: 9 additions & 4 deletions rootdir/etc/init.qcom.rc
Original file line number Diff line number Diff line change
Expand Up @@ -580,16 +580,21 @@ service wcg_mac_tool /vendor/bin/wcg_mac_tool
disabled
oneshot

service wlan-sh /vendor/bin/init.wlan.sh
service mac-sh /vendor/bin/init.mac.sh
class late_start
user root
group root
user root bluetooth
group root bluetooth
disabled
oneshot

on property:sys.boot_completed=1
start wcg_mac_tool
start wlan-sh
start mac-sh

on property:ro.vendor.bt.bdaddr_path=/data/vendor/bluetooth/bdaddr
# Correct perms for bdaddr
chmod 0644 /data/vendor/bluetooth/bdaddr
chown bluetooth bluetooth /data/vendor/bluetooth/bdaddr

on property:init.svc.vendor.hwcomposer-2-1=stopped
stop vendor.ppd
Expand Down
2 changes: 1 addition & 1 deletion sepolicy/file_contexts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Binaries
/(vendor|system/vendor)/bin/init.wlan.sh u:object_r:qti_init_shell_exec:s0
/(vendor|system/vendor)/bin/init.mac.sh u:object_r:qti_init_shell_exec:s0
/(vendor|system/vendor)/bin/wcg_mac_tool u:object_r:wcg_mac_exec:s0

# Bluetooth
Expand Down
2 changes: 2 additions & 0 deletions sepolicy/hal_bluetooth_qti.te
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
allow hal_bluetooth_qti sysfs_bluetooth_writable:file rw_file_perms;

get_prop(hal_bluetooth_qti, bt_mac_prop)
1 change: 1 addition & 0 deletions sepolicy/property.te
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
type wcg_prop, property_type;
type oem_unlock_prop, property_type;
type bt_mac_prop, property_type;
3 changes: 3 additions & 0 deletions sepolicy/property_contexts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Bluetooth
ro.vendor.bt.bdaddr_path u:object_r:bt_mac_prop:s0

# Camera
persist.camera. u:object_r:camera_prop:s0

Expand Down
5 changes: 5 additions & 0 deletions sepolicy/qti_init_shell.te
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ 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 read cmdline
allow qti_init_shell proc_cmdline:file { getattr open read };

get_prop(qti_init_shell, wcg_prop)
set_prop(qti_init_shell, oem_unlock_prop)
set_prop(qti_init_shell, bt_mac_prop)
1 change: 1 addition & 0 deletions sepolicy/system_app.te
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ allow system_app shell_prop:property_service set;

binder_call(system_app, wificond);
get_prop(system_app, oem_unlock_prop);
get_prop(system_app, bt_mac_prop);

0 comments on commit 5463eae

Please sign in to comment.