Skip to content

Commit

Permalink
wifi: create the sys property for wlan driver/firmware
Browse files Browse the repository at this point in the history
Bug: 76220544
Test:
No denial error found for selinux
Signed-off-by: Ecco Park <[email protected]>

Change-Id: If379812a7c8df7fd84beec6734313459938d540e
  • Loading branch information
eccopark committed Mar 26, 2018
1 parent f4a1fb2 commit 296546c
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions device.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
11 changes: 11 additions & 0 deletions init.hardware.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
6 changes: 6 additions & 0 deletions init.qcom.wlan.sh
Original file line number Diff line number Diff line change
@@ -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"
1 change: 1 addition & 0 deletions sepolicy/vendor/file.te
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions sepolicy/vendor/file_contexts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions sepolicy/vendor/genfs_contexts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions sepolicy/vendor/init-wlan-sh.te
Original file line number Diff line number Diff line change
@@ -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;
1 change: 1 addition & 0 deletions sepolicy/vendor/property.te
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 2 additions & 0 deletions sepolicy/vendor/property_contexts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions sepolicy/vendor/ssr_detector.te
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 296546c

Please sign in to comment.