diff --git a/device.mk b/device.mk index 636e01953..33eb28261 100755 --- a/device.mk +++ b/device.mk @@ -72,6 +72,7 @@ PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/uinput-fpc.idc:system/usr/idc/uinput-fpc.idc \ $(LOCAL_PATH)/init.qcom.devstart.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.devstart.sh \ $(LOCAL_PATH)/init.qcom.ipastart.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.ipastart.sh \ + $(LOCAL_PATH)/init.qcom.wlan.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.wlan.sh \ $(LOCAL_PATH)/init.insmod.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.insmod.sh \ $(LOCAL_PATH)/init.ramoops.sh:$(TARGET_COPY_OUT_SYSTEM)/bin/init.ramoops.sh \ frameworks/native/services/vr/virtual_touchpad/idc/vr-virtual-touchpad-0.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/vr-virtual-touchpad-0.idc \ diff --git a/init.hardware.rc b/init.hardware.rc index f344807b4..ce0af9d36 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -826,6 +826,13 @@ service vendor.devstart_sh /vendor/bin/init.qcom.devstart.sh disabled oneshot +service vendor.wlan_sh /vendor/bin/init.qcom.wlan.sh + class main + user root + group root + disabled + oneshot + service vendor.ipastart_sh /vendor/bin/init.qcom.ipastart.sh class main user system @@ -861,3 +868,7 @@ on property:sys.vdso=64 on property:sys.vdso=32 write /sys/module/vdso/parameters/enable_64 0 + +on property:wlan.driver.status=ok + # Get the wlan driver/fw version + start vendor.wlan_sh diff --git a/init.qcom.wlan.sh b/init.qcom.wlan.sh new file mode 100644 index 000000000..785870154 --- /dev/null +++ b/init.qcom.wlan.sh @@ -0,0 +1,6 @@ +#! /vendor/bin/sh + +wlan_driver_version=`cat /sys/kernel/wifi/wlan/driver_version` +setprop sys.wlan.driver.version "$wlan_driver_version" +wlan_fw_version=`cat /sys/kernel/wifi/wlan/fw/0/version` +setprop sys.wlan.firmware.version "$wlan_fw_version" diff --git a/sepolicy/vendor/file.te b/sepolicy/vendor/file.te index 467eb2978..9017790f6 100644 --- a/sepolicy/vendor/file.te +++ b/sepolicy/vendor/file.te @@ -8,6 +8,7 @@ type sysfs_laser, sysfs_type, fs_type; type sysfs_mdss_mdp_caps, sysfs_type, fs_type; type sysfs_msm_subsys, sysfs_type, fs_type; type sysfs_msm_subsys_restart, sysfs_type, fs_type; +type sysfs_msm_wlan, sysfs_type, fs_type; type sysfs_rmtfs, sysfs_type, fs_type; type sysfs_soc, sysfs_type, fs_type; type sysfs_scsi_devices_0000, sysfs_type, fs_type; diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index ddca8dec5..9c6901f93 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -178,6 +178,7 @@ /vendor/bin/imsrcsd u:object_r:hal_rcsservice_exec:s0 /vendor/bin/init\.qcom\.devstart\.sh u:object_r:init-qcom-devstart-sh_exec:s0 /vendor/bin/init\.qcom\.ipastart\.sh u:object_r:init-qcom-ipastart-sh_exec:s0 +/vendor/bin/init\.qcom\.wlan\.sh u:object_r:init-qcom-wlan-sh_exec:s0 /vendor/bin/init\.insmod\.sh u:object_r:init-insmod-sh_exec:s0 /vendor/etc/init\.insmod\.cfg u:object_r:init-insmod-sh_exec:s0 /vendor/bin/init\.power\.sh u:object_r:init_power_exec:s0 diff --git a/sepolicy/vendor/genfs_contexts b/sepolicy/vendor/genfs_contexts index fda77c2ff..dd1ad28aa 100644 --- a/sepolicy/vendor/genfs_contexts +++ b/sepolicy/vendor/genfs_contexts @@ -67,6 +67,7 @@ genfscon sysfs /bus/msm_subsys u:object genfscon sysfs /module/subsystem_restart u:object_r:sysfs_msm_subsys_restart:s0 genfscon sysfs /kernel/boot_adsp/boot u:object_r:sysfs_msm_subsys:s0 genfscon sysfs /kernel/boot_slpi/boot u:object_r:sysfs_msm_subsys:s0 +genfscon sysfs /kernel/wifi/wlan u:object_r:sysfs_msm_wlan:s0 genfscon sysfs /kernel/memory_state_time u:object_r:sysfs_power:s0 genfscon sysfs /devices/soc/c1b7000.i2c/i2c-9/9-0008 u:object_r:sysfs_easel:s0 genfscon sysfs /class/typec u:object_r:sysfs_usb_c:s0 diff --git a/sepolicy/vendor/init-wlan-sh.te b/sepolicy/vendor/init-wlan-sh.te new file mode 100644 index 000000000..36179ef68 --- /dev/null +++ b/sepolicy/vendor/init-wlan-sh.te @@ -0,0 +1,14 @@ +type init-qcom-wlan-sh, domain; +type init-qcom-wlan-sh_exec, exec_type, vendor_file_type, file_type; + +init_daemon_domain(init-qcom-wlan-sh) + +allow init-qcom-wlan-sh vendor_shell_exec:file rx_file_perms; +allow init-qcom-wlan-sh vendor_toolbox_exec:file rx_file_perms; + +# Set the sys.wlan.driver.version and sys.wlan.firmware.version property +set_prop(init-qcom-wlan-sh, vendor_wifi_version) + +# /sys/kernel/wifi/wlan/driver_version and /sys/kernel/wifi/wlan/fw/0/version +allow init-qcom-wlan-sh sysfs_msm_wlan:dir r_dir_perms; +allow init-qcom-wlan-sh sysfs_msm_wlan:file r_file_perms; diff --git a/sepolicy/vendor/property.te b/sepolicy/vendor/property.te index 09fa6df03..909b57cf1 100644 --- a/sepolicy/vendor/property.te +++ b/sepolicy/vendor/property.te @@ -20,3 +20,4 @@ type bluetooth_log_prop, property_type; type power_prop, property_type; type vendor_net_radio_prop, property_type; type vendor_radio_prop, property_type; +type vendor_wifi_version, property_type; diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index 8e5c0ce93..be8a5772a 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -28,6 +28,8 @@ persist.radio.atfwd.start u:object_r:atfwd_start_prop:s0 sys.logger.bluetooth u:object_r:bluetooth_log_prop:s0 vendor.powerhal.state u:object_r:power_prop:s0 vendor.powerhal.audio u:object_r:power_prop:s0 +sys.wlan.driver.version u:object_r:vendor_wifi_version:s0 +sys.wlan.firmware.version u:object_r:vendor_wifi_version:s0 # public_vendor_default_prop # They are public_vendor_default_props for vendor-specific extension. diff --git a/sepolicy/vendor/ssr_detector.te b/sepolicy/vendor/ssr_detector.te index 27882d519..9144b1ff1 100644 --- a/sepolicy/vendor/ssr_detector.te +++ b/sepolicy/vendor/ssr_detector.te @@ -7,6 +7,7 @@ userdebug_or_eng(` allow ssr_detector_app ramdump_vendor_data_file:dir r_dir_perms; allow ssr_detector_app ramdump_vendor_data_file:file r_file_perms; get_prop(ssr_detector_app, ssr_prop) + get_prop(ssr_detector_app, vendor_wifi_version) ') allow ssr_detector_app app_api_service:service_manager find;