Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
746e47cb
S
Startup Init Lite
项目概览
OpenHarmony
/
Startup Init Lite
大约 1 年 前同步成功
通知
3
Star
37
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Startup Init Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
746e47cb
编写于
7月 09, 2021
作者:
Z
zhong_ning
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify l2 init
Signed-off-by:
N
zhong_ning
<
zhong_ning@hoperun.com
>
上级
754d3970
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
111 addition
and
85 deletion
+111
-85
services/BUILD.gn
services/BUILD.gn
+21
-14
services/etc/init.cfg
services/etc/init.cfg
+13
-13
services/etc/init.usb.cfg
services/etc/init.usb.cfg
+14
-14
services/etc/init.usb.configfs.cfg
services/etc/init.usb.configfs.cfg
+25
-25
services/param/trigger/trigger_manager.c
services/param/trigger/trigger_manager.c
+4
-15
services/param/trigger/trigger_processor.c
services/param/trigger/trigger_processor.c
+1
-1
services/src/init_service.c
services/src/init_service.c
+33
-3
未找到文件。
services/BUILD.gn
浏览文件 @
746e47cb
...
@@ -141,6 +141,21 @@ if (defined(ohos_lite)) {
...
@@ -141,6 +141,21 @@ if (defined(ohos_lite)) {
part_name = "init"
part_name = "init"
}
}
group("startup_init") {
deps = [
":init",
":init_etc",
":updaterueventd",
"//base/startup/init_lite/interfaces/innerkits/socket:libsocket",
"//base/startup/init_lite/services/param:getparam",
"//base/startup/init_lite/services/param:paramclient",
"//base/startup/init_lite/services/param:paramservice",
"//base/startup/init_lite/services/param:setparam",
"//base/startup/init_lite/services/reboot:reboot",
]
}
# init etc files group
ohos_prebuilt_etc("init.cfg") {
ohos_prebuilt_etc("init.cfg") {
source = "//base/startup/init_lite/services/etc/init.cfg"
source = "//base/startup/init_lite/services/etc/init.cfg"
part_name = "init"
part_name = "init"
...
@@ -167,26 +182,18 @@ if (defined(ohos_lite)) {
...
@@ -167,26 +182,18 @@ if (defined(ohos_lite)) {
}
}
ohos_prebuilt_etc("init.Hi3516DV300.usb.cfg") {
ohos_prebuilt_etc("init.Hi3516DV300.usb.cfg") {
source = "//device/hisilicon/hi3516dv300/build/rootfs/init.Hi3516DV300.usb.cfg"
source =
"//device/hisilicon/hi3516dv300/build/rootfs/init.Hi3516DV300.usb.cfg"
part_name = "init"
part_name = "init"
}
}
group("init_etc") {
group("startup_init") {
deps = [
deps = [
":init",
":init.cfg",
":passwd",
":init.Hi3516DV300.cfg",
":init.Hi3516DV300.cfg",
":init.Hi3516DV300.usb.cfg",
":init.cfg",
":init.usb.cfg",
":init.usb.cfg",
":init.usb.configfs.cfg",
":init.usb.configfs.cfg",
":init.Hi3516DV300.usb.cfg",
":passwd",
":updaterueventd",
"//base/startup/init_lite/services/param:getparam",
"//base/startup/init_lite/services/param:paramclient",
"//base/startup/init_lite/services/param:paramservice",
"//base/startup/init_lite/services/param:setparam",
"//base/startup/init_lite/services/reboot:reboot",
"//base/startup/init_lite/interfaces/innerkits/socket:libsocket",
]
]
}
}
}
}
services/etc/init.cfg
浏览文件 @
746e47cb
...
@@ -187,7 +187,7 @@
...
@@ -187,7 +187,7 @@
"start vndservicemanager"
"start vndservicemanager"
]
]
}, {
}, {
"name" : "p
roperty
:sys.boot_from_charger_mode=1",
"name" : "p
aram
:sys.boot_from_charger_mode=1",
"condition" : "sys.boot_from_charger_mode=1",
"condition" : "sys.boot_from_charger_mode=1",
"cmds" : [
"cmds" : [
"trigger post-init"
"trigger post-init"
...
@@ -467,7 +467,7 @@
...
@@ -467,7 +467,7 @@
"cmds" : [
"cmds" : [
]
]
}, {
}, {
"name" : "p
roperty
:sys.init_log_level=*",
"name" : "p
aram
:sys.init_log_level=*",
"condition" : "sys.init_log_level=*",
"condition" : "sys.init_log_level=*",
"cmds" : [
"cmds" : [
]
]
...
@@ -476,7 +476,7 @@
...
@@ -476,7 +476,7 @@
"cmds" : [
"cmds" : [
]
]
}, {
}, {
"name" : "p
roperty
:vold.decrypt=trigger_load_persist_props",
"name" : "p
aram
:vold.decrypt=trigger_load_persist_props",
"condition" : "vold.decrypt=trigger_load_persist_props",
"condition" : "vold.decrypt=trigger_load_persist_props",
"cmds" : [
"cmds" : [
"load_persist_params load_persist_params",
"load_persist_params load_persist_params",
...
@@ -484,48 +484,48 @@
...
@@ -484,48 +484,48 @@
"start logd-reinit"
"start logd-reinit"
]
]
}, {
}, {
"name" : "p
roperty
:vold.decrypt=trigger_post_fs_data",
"name" : "p
aram
:vold.decrypt=trigger_post_fs_data",
"condition" : "vold.decrypt=trigger_post_fs_data",
"condition" : "vold.decrypt=trigger_post_fs_data",
"cmds" : [
"cmds" : [
"trigger post-fs-data",
"trigger post-fs-data",
"trigger zygote-start"
"trigger zygote-start"
]
]
}, {
}, {
"name" : "p
roperty
:vold.decrypt=trigger_restart_min_framework",
"name" : "p
aram
:vold.decrypt=trigger_restart_min_framework",
"condition" : "vold.decrypt=trigger_restart_min_framework",
"condition" : "vold.decrypt=trigger_restart_min_framework",
"cmds" : [
"cmds" : [
]
]
}, {
}, {
"name" : "p
roperty
:vold.decrypt=trigger_restart_framework",
"name" : "p
aram
:vold.decrypt=trigger_restart_framework",
"condition" : "vold.decrypt=trigger_restart_framework",
"condition" : "vold.decrypt=trigger_restart_framework",
"cmds" : [
"cmds" : [
"setparam service.bootanim.exit 0",
"setparam service.bootanim.exit 0",
"start bootanim"
"start bootanim"
]
]
}, {
}, {
"name" : "p
roperty
:vold.decrypt=trigger_shutdown_framework",
"name" : "p
aram
:vold.decrypt=trigger_shutdown_framework",
"condition" : "vold.decrypt=trigger_shutdown_framework",
"condition" : "vold.decrypt=trigger_shutdown_framework",
"cmds" : [
"cmds" : [
]
]
}, {
}, {
"name" : "p
roperty
:sys.boot_completed=1",
"name" : "p
aram
:sys.boot_completed=1",
"condition" : "sys.boot_completed=1",
"condition" : "sys.boot_completed=1",
"cmds" : [
"cmds" : [
]
]
}, {
}, {
"name" : "p
roperty
:sys.sysctl.extra_free_kbytes=*",
"name" : "p
aram
:sys.sysctl.extra_free_kbytes=*",
"condition" : "sys.sysctl.extra_free_kbytes=*",
"condition" : "sys.sysctl.extra_free_kbytes=*",
"cmds" : [
"cmds" : [
"write /proc/sys/vm/extra_free_kbytes ${sys.sysctl.extra_free_kbytes}"
"write /proc/sys/vm/extra_free_kbytes ${sys.sysctl.extra_free_kbytes}"
]
]
}, {
}, {
"name" : "p
roperty
:sys.sysctl.tcp_def_init_rwnd=*",
"name" : "p
aram
:sys.sysctl.tcp_def_init_rwnd=*",
"condition" : "sys.sysctl.tcp_def_init_rwnd=*",
"condition" : "sys.sysctl.tcp_def_init_rwnd=*",
"cmds" : [
"cmds" : [
"write /proc/sys/net/ipv4/tcp_default_init_rwnd ${sys.sysctl.tcp_def_init_rwnd}"
"write /proc/sys/net/ipv4/tcp_default_init_rwnd ${sys.sysctl.tcp_def_init_rwnd}"
]
]
}, {
}, {
"name" : "p
roperty
:security.perf_harden=0",
"name" : "p
aram
:security.perf_harden=0",
"condition" : "security.perf_harden=0",
"condition" : "security.perf_harden=0",
"cmds" : [
"cmds" : [
"write /proc/sys/kernel/perf_event_paranoid 1",
"write /proc/sys/kernel/perf_event_paranoid 1",
...
@@ -534,13 +534,13 @@
...
@@ -534,13 +534,13 @@
"write /proc/sys/kernel/perf_event_mlock_kb ${debug.perf_event_mlock_kb:-516}"
"write /proc/sys/kernel/perf_event_mlock_kb ${debug.perf_event_mlock_kb:-516}"
]
]
}, {
}, {
"name" : "p
roperty
:security.perf_harden=1",
"name" : "p
aram
:security.perf_harden=1",
"condition" : "security.perf_harden=1",
"condition" : "security.perf_harden=1",
"cmds" : [
"cmds" : [
"write /proc/sys/kernel/perf_event_paranoid 3"
"write /proc/sys/kernel/perf_event_paranoid 3"
]
]
}, {
}, {
"name" : "p
roperty
:ro.debuggable=1",
"name" : "p
aram
:ro.debuggable=1",
"condition" : "ro.debuggable=1",
"condition" : "ro.debuggable=1",
"cmds" : [
"cmds" : [
"chmod 0773 /data/misc/trace",
"chmod 0773 /data/misc/trace",
...
...
services/etc/init.usb.cfg
浏览文件 @
746e47cb
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
"setparam sys.usb.configfs 0"
"setparam sys.usb.configfs 0"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.config=none && property
:sys.usb.configfs=0",
"name" : "p
aram:sys.usb.config=none && param
:sys.usb.configfs=0",
"condition" : "sys.usb.config=none && sys.usb.configfs=0",
"condition" : "sys.usb.config=none && sys.usb.configfs=0",
"cmds" : [
"cmds" : [
"stop adbd",
"stop adbd",
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
"setparam sys.usb.state ${sys.usb.config}"
"setparam sys.usb.state ${sys.usb.config}"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.config=adb && property
:sys.usb.configfs=0",
"name" : "p
aram:sys.usb.config=adb && param
:sys.usb.configfs=0",
"condition" : "sys.usb.config=adb && sys.usb.configfs=0",
"condition" : "sys.usb.config=adb && sys.usb.configfs=0",
"cmds" : [
"cmds" : [
"write /sys/class/android_usb/android0/enable 0",
"write /sys/class/android_usb/android0/enable 0",
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
"setparam sys.usb.state ${sys.usb.config}"
"setparam sys.usb.state ${sys.usb.config}"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.config=accessory && property
:sys.usb.configfs=0",
"name" : "p
aram:sys.usb.config=accessory && param
:sys.usb.configfs=0",
"condition" : "sys.usb.config=accessory && sys.usb.configfs=0",
"condition" : "sys.usb.config=accessory && sys.usb.configfs=0",
"cmds" : [
"cmds" : [
"write /sys/class/android_usb/android0/enable 0",
"write /sys/class/android_usb/android0/enable 0",
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
"setparam sys.usb.state ${sys.usb.config}"
"setparam sys.usb.state ${sys.usb.config}"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.config=accessory,adb && property
:sys.usb.configfs=0",
"name" : "p
aram:sys.usb.config=accessory,adb && param
:sys.usb.configfs=0",
"condition" : "sys.usb.config=accessory,adb && sys.usb.configfs=0",
"condition" : "sys.usb.config=accessory,adb && sys.usb.configfs=0",
"cmds" : [
"cmds" : [
"write /sys/class/android_usb/android0/enable 0",
"write /sys/class/android_usb/android0/enable 0",
...
@@ -60,7 +60,7 @@
...
@@ -60,7 +60,7 @@
"setparam sys.usb.state ${sys.usb.config}"
"setparam sys.usb.state ${sys.usb.config}"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.config=audio_source && property
:sys.usb.configfs=0",
"name" : "p
aram:sys.usb.config=audio_source && param
:sys.usb.configfs=0",
"condition" : "sys.usb.config=audio_source && sys.usb.configfs=0",
"condition" : "sys.usb.config=audio_source && sys.usb.configfs=0",
"cmds" : [
"cmds" : [
"write /sys/class/android_usb/android0/enable 0",
"write /sys/class/android_usb/android0/enable 0",
...
@@ -71,7 +71,7 @@
...
@@ -71,7 +71,7 @@
"setparam sys.usb.state ${sys.usb.config}"
"setparam sys.usb.state ${sys.usb.config}"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.config=audio_source,adb && property
:sys.usb.configfs=0",
"name" : "p
aram:sys.usb.config=audio_source,adb && param
:sys.usb.configfs=0",
"condition" : "sys.usb.config=audio_source,adb && sys.usb.configfs=0",
"condition" : "sys.usb.config=audio_source,adb && sys.usb.configfs=0",
"cmds" : [
"cmds" : [
"write /sys/class/android_usb/android0/enable 0",
"write /sys/class/android_usb/android0/enable 0",
...
@@ -83,7 +83,7 @@
...
@@ -83,7 +83,7 @@
"setparam sys.usb.state ${sys.usb.config}"
"setparam sys.usb.state ${sys.usb.config}"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.config=accessory,audio_source && property
:sys.usb.configfs=0",
"name" : "p
aram:sys.usb.config=accessory,audio_source && param
:sys.usb.configfs=0",
"condition" : "sys.usb.config=accessory,audio_source && sys.usb.configfs=0",
"condition" : "sys.usb.config=accessory,audio_source && sys.usb.configfs=0",
"cmds" : [
"cmds" : [
"write /sys/class/android_usb/android0/enable 0",
"write /sys/class/android_usb/android0/enable 0",
...
@@ -94,7 +94,7 @@
...
@@ -94,7 +94,7 @@
"setparam sys.usb.state ${sys.usb.config}"
"setparam sys.usb.state ${sys.usb.config}"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.config=accessory,audio_source,adb && property
:sys.usb.configfs=0",
"name" : "p
aram:sys.usb.config=accessory,audio_source,adb && param
:sys.usb.configfs=0",
"condition" : "sys.usb.config=accessory,audio_source,adb && sys.usb.configfs=0",
"condition" : "sys.usb.config=accessory,audio_source,adb && sys.usb.configfs=0",
"cmds" : [
"cmds" : [
"write /sys/class/android_usb/android0/enable 0",
"write /sys/class/android_usb/android0/enable 0",
...
@@ -106,42 +106,42 @@
...
@@ -106,42 +106,42 @@
"setparam sys.usb.state ${sys.usb.config}"
"setparam sys.usb.state ${sys.usb.config}"
]
]
}, {
}, {
"name" : "p
roperty
:sys.usb.typec.mode=dfp",
"name" : "p
aram
:sys.usb.typec.mode=dfp",
"condition" : "sys.usb.typec.mode=dfp",
"condition" : "sys.usb.typec.mode=dfp",
"cmds" : [
"cmds" : [
"write /sys/class/dual_role_usb/otg_default/mode ${sys.usb.typec.mode}",
"write /sys/class/dual_role_usb/otg_default/mode ${sys.usb.typec.mode}",
"setparam sys.usb.typec.state ${sys.usb.typec.mode}"
"setparam sys.usb.typec.state ${sys.usb.typec.mode}"
]
]
}, {
}, {
"name" : "p
roperty
:sys.usb.typec.mode=ufp",
"name" : "p
aram
:sys.usb.typec.mode=ufp",
"condition" : "sys.usb.typec.mode=ufp",
"condition" : "sys.usb.typec.mode=ufp",
"cmds" : [
"cmds" : [
"write /sys/class/dual_role_usb/otg_default/mode ${sys.usb.typec.mode}",
"write /sys/class/dual_role_usb/otg_default/mode ${sys.usb.typec.mode}",
"setparam sys.usb.typec.state ${sys.usb.typec.mode}"
"setparam sys.usb.typec.state ${sys.usb.typec.mode}"
]
]
}, {
}, {
"name" : "p
roperty
:sys.usb.typec.data_role=device",
"name" : "p
aram
:sys.usb.typec.data_role=device",
"condition" : "sys.usb.typec.data_role=device",
"condition" : "sys.usb.typec.data_role=device",
"cmds" : [
"cmds" : [
"write /sys/class/dual_role_usb/otg_default/data_role ${sys.usb.typec.data_role}",
"write /sys/class/dual_role_usb/otg_default/data_role ${sys.usb.typec.data_role}",
"setparam sys.usb.typec.state ${sys.usb.typec.data_role}"
"setparam sys.usb.typec.state ${sys.usb.typec.data_role}"
]
]
}, {
}, {
"name" : "p
roperty
:sys.usb.typec.data_role=host",
"name" : "p
aram
:sys.usb.typec.data_role=host",
"condition" : "sys.usb.typec.data_role=host",
"condition" : "sys.usb.typec.data_role=host",
"cmds" : [
"cmds" : [
"write /sys/class/dual_role_usb/otg_default/data_role ${sys.usb.typec.data_role}",
"write /sys/class/dual_role_usb/otg_default/data_role ${sys.usb.typec.data_role}",
"setparam sys.usb.typec.state ${sys.usb.typec.data_role}"
"setparam sys.usb.typec.state ${sys.usb.typec.data_role}"
]
]
}, {
}, {
"name" : "p
roperty
:sys.usb.typec.power_role=source",
"name" : "p
aram
:sys.usb.typec.power_role=source",
"condition" : "sys.usb.typec.power_role=source",
"condition" : "sys.usb.typec.power_role=source",
"cmds" : [
"cmds" : [
"write /sys/class/dual_role_usb/otg_default/power_role ${sys.usb.typec.power_role}",
"write /sys/class/dual_role_usb/otg_default/power_role ${sys.usb.typec.power_role}",
"setparam sys.usb.typec.state ${sys.usb.typec.power_role}"
"setparam sys.usb.typec.state ${sys.usb.typec.power_role}"
]
]
}, {
}, {
"name" : "p
roperty
:sys.usb.typec.power_role=sink",
"name" : "p
aram
:sys.usb.typec.power_role=sink",
"condition" : "sys.usb.typec.power_role=sink",
"condition" : "sys.usb.typec.power_role=sink",
"cmds" : [
"cmds" : [
"write /sys/class/dual_role_usb/otg_default/power_role ${sys.usb.typec.power_role}",
"write /sys/class/dual_role_usb/otg_default/power_role ${sys.usb.typec.power_role}",
...
...
services/etc/init.usb.configfs.cfg
浏览文件 @
746e47cb
{
{
"jobs" : [{
"jobs" : [{
"name" : "p
roperty:sys.usb.config=none && property
:sys.usb.configfs=1",
"name" : "p
aram:sys.usb.config=none && param
:sys.usb.configfs=1",
"condition" : "sys.usb.config=none && sys.usb.configfs=1",
"condition" : "sys.usb.config=none && sys.usb.configfs=1",
"cmds" : [
"cmds" : [
"write /config/usb_gadget/g1/UDC \"none\"",
"write /config/usb_gadget/g1/UDC \"none\"",
...
@@ -16,19 +16,19 @@
...
@@ -16,19 +16,19 @@
"setparam sys.usb.state ${sys.usb.config}"
"setparam sys.usb.state ${sys.usb.config}"
]
]
}, {
}, {
"name" : "p
roperty
:init.svc.adbd=stopped",
"name" : "p
aram
:init.svc.adbd=stopped",
"condition" : "init.svc.adbd=stopped",
"condition" : "init.svc.adbd=stopped",
"cmds" : [
"cmds" : [
"setparam sys.usb.ffs.ready 0"
"setparam sys.usb.ffs.ready 0"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.config=adb && property
:sys.usb.configfs=1",
"name" : "p
aram:sys.usb.config=adb && param
:sys.usb.configfs=1",
"condition" : "sys.usb.config=adb && sys.usb.configfs=1",
"condition" : "sys.usb.config=adb && sys.usb.configfs=1",
"cmds" : [
"cmds" : [
"start adbd"
"start adbd"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.ffs.ready=1 && property:sys.usb.config=adb && property
:sys.usb.configfs=1",
"name" : "p
aram:sys.usb.ffs.ready=1 && param:sys.usb.config=adb && param
:sys.usb.configfs=1",
"condition" : "sys.usb.ffs.ready=1 && sys.usb.config=adb && sys.usb.configfs=1",
"condition" : "sys.usb.ffs.ready=1 && sys.usb.config=adb && sys.usb.configfs=1",
"cmds" : [
"cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"adb\"",
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"adb\"",
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
"setparam sys.usb.state ${sys.usb.config}"
"setparam sys.usb.state ${sys.usb.config}"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.config=mtp && property
:sys.usb.configfs=1",
"name" : "p
aram:sys.usb.config=mtp && param
:sys.usb.configfs=1",
"condition" : "sys.usb.config=mtp && sys.usb.configfs=1",
"condition" : "sys.usb.config=mtp && sys.usb.configfs=1",
"cmds" : [
"cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"mtp\"",
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"mtp\"",
...
@@ -46,13 +46,13 @@
...
@@ -46,13 +46,13 @@
"setparam sys.usb.state ${sys.usb.config}"
"setparam sys.usb.state ${sys.usb.config}"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.config=mtp,adb && property
:sys.usb.configfs=1",
"name" : "p
aram:sys.usb.config=mtp,adb && param
:sys.usb.configfs=1",
"condition" : "sys.usb.config=mtp,adb && sys.usb.configfs=1",
"condition" : "sys.usb.config=mtp,adb && sys.usb.configfs=1",
"cmds" : [
"cmds" : [
"start adbd"
"start adbd"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb && property
:sys.usb.configfs=1",
"name" : "p
aram:sys.usb.ffs.ready=1 && param:sys.usb.config=mtp,adb && param
:sys.usb.configfs=1",
"condition" : "sys.usb.ffs.ready=1 && sys.usb.config=mtp,adb && sys.usb.configfs=1",
"condition" : "sys.usb.ffs.ready=1 && sys.usb.config=mtp,adb && sys.usb.configfs=1",
"cmds" : [
"cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"mtp_adb\"",
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"mtp_adb\"",
...
@@ -62,7 +62,7 @@
...
@@ -62,7 +62,7 @@
"setparam sys.usb.state ${sys.usb.config}"
"setparam sys.usb.state ${sys.usb.config}"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.config=ptp && property
:sys.usb.configfs=1",
"name" : "p
aram:sys.usb.config=ptp && param
:sys.usb.configfs=1",
"condition" : "sys.usb.config=ptp && sys.usb.configfs=1",
"condition" : "sys.usb.config=ptp && sys.usb.configfs=1",
"cmds" : [
"cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"ptp\"",
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"ptp\"",
...
@@ -71,13 +71,13 @@
...
@@ -71,13 +71,13 @@
"setparam sys.usb.state ${sys.usb.config}"
"setparam sys.usb.state ${sys.usb.config}"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.config=ptp,adb && property
:sys.usb.configfs=1",
"name" : "p
aram:sys.usb.config=ptp,adb && param
:sys.usb.configfs=1",
"condition" : "sys.usb.config=ptp,adb && sys.usb.configfs=1",
"condition" : "sys.usb.config=ptp,adb && sys.usb.configfs=1",
"cmds" : [
"cmds" : [
"start adbd"
"start adbd"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && property
:sys.usb.configfs=1",
"name" : "p
aram:sys.usb.ffs.ready=1 && param:sys.usb.config=ptp,adb && param
:sys.usb.configfs=1",
"condition" : "sys.usb.ffs.ready=1 && sys.usb.config=ptp,adb && sys.usb.configfs=1",
"condition" : "sys.usb.ffs.ready=1 && sys.usb.config=ptp,adb && sys.usb.configfs=1",
"cmds" : [
"cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"ptp_adb\"",
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"ptp_adb\"",
...
@@ -87,7 +87,7 @@
...
@@ -87,7 +87,7 @@
"setparam sys.usb.state ${sys.usb.config}"
"setparam sys.usb.state ${sys.usb.config}"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.config=accessory && property
:sys.usb.configfs=1",
"name" : "p
aram:sys.usb.config=accessory && param
:sys.usb.configfs=1",
"condition" : "sys.usb.config=accessory && sys.usb.configfs=1",
"condition" : "sys.usb.config=accessory && sys.usb.configfs=1",
"cmds" : [
"cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"accessory\"",
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"accessory\"",
...
@@ -96,13 +96,13 @@
...
@@ -96,13 +96,13 @@
"setparam sys.usb.state ${sys.usb.config}"
"setparam sys.usb.state ${sys.usb.config}"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.config=accessory,adb && property
:sys.usb.configfs=1",
"name" : "p
aram:sys.usb.config=accessory,adb && param
:sys.usb.configfs=1",
"condition" : "sys.usb.config=accessory,adb && sys.usb.configfs=1",
"condition" : "sys.usb.config=accessory,adb && sys.usb.configfs=1",
"cmds" : [
"cmds" : [
"start adbd"
"start adbd"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.ffs.ready=1 && property:sys.usb.config=accessory,adb && property
:sys.usb.configfs=1",
"name" : "p
aram:sys.usb.ffs.ready=1 && param:sys.usb.config=accessory,adb && param
:sys.usb.configfs=1",
"condition" : "sys.usb.ffs.ready=1 && sys.usb.config=accessory,adb && sys.usb.configfs=1",
"condition" : "sys.usb.ffs.ready=1 && sys.usb.config=accessory,adb && sys.usb.configfs=1",
"cmds" : [
"cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"accessory_adb\"",
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"accessory_adb\"",
...
@@ -112,7 +112,7 @@
...
@@ -112,7 +112,7 @@
"setparam sys.usb.state ${sys.usb.config}"
"setparam sys.usb.state ${sys.usb.config}"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.config=audio_source && property
:sys.usb.configfs=1",
"name" : "p
aram:sys.usb.config=audio_source && param
:sys.usb.configfs=1",
"condition" : "sys.usb.config=audio_source && sys.usb.configfs=1",
"condition" : "sys.usb.config=audio_source && sys.usb.configfs=1",
"cmds" : [
"cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"audiosource\"",
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"audiosource\"",
...
@@ -121,13 +121,13 @@
...
@@ -121,13 +121,13 @@
"setparam sys.usb.state ${sys.usb.config}"
"setparam sys.usb.state ${sys.usb.config}"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.config=audio_source,adb && property
:sys.usb.configfs=1",
"name" : "p
aram:sys.usb.config=audio_source,adb && param
:sys.usb.configfs=1",
"condition" : "sys.usb.config=audio_source,adb && sys.usb.configfs=1",
"condition" : "sys.usb.config=audio_source,adb && sys.usb.configfs=1",
"cmds" : [
"cmds" : [
"start adbd"
"start adbd"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.ffs.ready=1 && property:sys.usb.config=audio_source,adb && property
:sys.usb.configfs=1",
"name" : "p
aram:sys.usb.ffs.ready=1 && param:sys.usb.config=audio_source,adb && param
:sys.usb.configfs=1",
"condition" : "sys.usb.ffs.ready=1 && sys.usb.config=audio_source,adb && sys.usb.configfs=1",
"condition" : "sys.usb.ffs.ready=1 && sys.usb.config=audio_source,adb && sys.usb.configfs=1",
"cmds" : [
"cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"audiosource_adb\"",
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"audiosource_adb\"",
...
@@ -137,7 +137,7 @@
...
@@ -137,7 +137,7 @@
"setparam sys.usb.state ${sys.usb.config}"
"setparam sys.usb.state ${sys.usb.config}"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.config=accessory,audio_source && property
:sys.usb.configfs=1",
"name" : "p
aram:sys.usb.config=accessory,audio_source && param
:sys.usb.configfs=1",
"condition" : "sys.usb.config=accessory,audio_source && sys.usb.configfs=1",
"condition" : "sys.usb.config=accessory,audio_source && sys.usb.configfs=1",
"cmds" : [
"cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"accessory_audiosource\"",
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"accessory_audiosource\"",
...
@@ -147,13 +147,13 @@
...
@@ -147,13 +147,13 @@
"setparam sys.usb.state ${sys.usb.config}"
"setparam sys.usb.state ${sys.usb.config}"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.config=accessory,audio_source,adb && property
:sys.usb.configfs=1",
"name" : "p
aram:sys.usb.config=accessory,audio_source,adb && param
:sys.usb.configfs=1",
"condition" : "sys.usb.config=accessory,audio_source,adb && sys.usb.configfs=1",
"condition" : "sys.usb.config=accessory,audio_source,adb && sys.usb.configfs=1",
"cmds" : [
"cmds" : [
"start adbd"
"start adbd"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.ffs.ready=1 && property:sys.usb.config=accessory,audio_source,adb && property
:sys.usb.configfs=1",
"name" : "p
aram:sys.usb.ffs.ready=1 && param:sys.usb.config=accessory,audio_source,adb && param
:sys.usb.configfs=1",
"condition" : "sys.usb.ffs.ready=1 && sys.usb.config=accessory,audio_source,adb && sys.usb.configfs=1",
"condition" : "sys.usb.ffs.ready=1 && sys.usb.config=accessory,audio_source,adb && sys.usb.configfs=1",
"cmds" : [
"cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"accessory_audiosource_adb\"",
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"accessory_audiosource_adb\"",
...
@@ -164,7 +164,7 @@
...
@@ -164,7 +164,7 @@
"setparam sys.usb.state ${sys.usb.config}"
"setparam sys.usb.state ${sys.usb.config}"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.config=midi && property
:sys.usb.configfs=1",
"name" : "p
aram:sys.usb.config=midi && param
:sys.usb.configfs=1",
"condition" : "sys.usb.config=midi && sys.usb.configfs=1",
"condition" : "sys.usb.config=midi && sys.usb.configfs=1",
"cmds" : [
"cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"midi\"",
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"midi\"",
...
@@ -173,13 +173,13 @@
...
@@ -173,13 +173,13 @@
"setparam sys.usb.state ${sys.usb.config}"
"setparam sys.usb.state ${sys.usb.config}"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.config=midi,adb && property
:sys.usb.configfs=1",
"name" : "p
aram:sys.usb.config=midi,adb && param
:sys.usb.configfs=1",
"condition" : "sys.usb.config=midi,adb && sys.usb.configfs=1",
"condition" : "sys.usb.config=midi,adb && sys.usb.configfs=1",
"cmds" : [
"cmds" : [
"start adbd"
"start adbd"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.ffs.ready=1 && property:sys.usb.config=midi,adb && property
:sys.usb.configfs=1",
"name" : "p
aram:sys.usb.ffs.ready=1 && param:sys.usb.config=midi,adb && param
:sys.usb.configfs=1",
"condition" : "sys.usb.ffs.ready=1 && sys.usb.config=midi,adb && sys.usb.configfs=1",
"condition" : "sys.usb.ffs.ready=1 && sys.usb.config=midi,adb && sys.usb.configfs=1",
"cmds" : [
"cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"midi_adb\"",
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"midi_adb\"",
...
@@ -189,7 +189,7 @@
...
@@ -189,7 +189,7 @@
"setparam sys.usb.state ${sys.usb.config}"
"setparam sys.usb.state ${sys.usb.config}"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.config=rndis && property
:sys.usb.configfs=1",
"name" : "p
aram:sys.usb.config=rndis && param
:sys.usb.configfs=1",
"condition" : "sys.usb.config=rndis && sys.usb.configfs=1",
"condition" : "sys.usb.config=rndis && sys.usb.configfs=1",
"cmds" : [
"cmds" : [
"mkdir /config/usb_gadget/g1/functions/rndis.gs4",
"mkdir /config/usb_gadget/g1/functions/rndis.gs4",
...
@@ -199,13 +199,13 @@
...
@@ -199,13 +199,13 @@
"setparam sys.usb.state ${sys.usb.config}"
"setparam sys.usb.state ${sys.usb.config}"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.config=rndis,adb && property
:sys.usb.configfs=1",
"name" : "p
aram:sys.usb.config=rndis,adb && param
:sys.usb.configfs=1",
"condition" : "sys.usb.config=rndis,adb && sys.usb.configfs=1",
"condition" : "sys.usb.config=rndis,adb && sys.usb.configfs=1",
"cmds" : [
"cmds" : [
"start adbd"
"start adbd"
]
]
}, {
}, {
"name" : "p
roperty:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb && property
:sys.usb.configfs=1",
"name" : "p
aram:sys.usb.ffs.ready=1 && param:sys.usb.config=rndis,adb && param
:sys.usb.configfs=1",
"condition" : "sys.usb.ffs.ready=1 && sys.usb.config=rndis,adb && sys.usb.configfs=1",
"condition" : "sys.usb.ffs.ready=1 && sys.usb.config=rndis,adb && sys.usb.configfs=1",
"cmds" : [
"cmds" : [
"mkdir /config/usb_gadget/g1/functions/rndis.gs4",
"mkdir /config/usb_gadget/g1/functions/rndis.gs4",
...
...
services/param/trigger/trigger_manager.c
浏览文件 @
746e47cb
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
#include "trigger_checker.h"
#include "trigger_checker.h"
#define LABEL "Trigger"
#define LABEL "Trigger"
#define TRIGGER_AREA_SPACE 1024*
64
#define TRIGGER_AREA_SPACE 1024*
128
#define TRIGGER_EXECUTE_QUEUE 64
#define TRIGGER_EXECUTE_QUEUE 64
#define BUFFER_SIZE 256
#define BUFFER_SIZE 256
#define CHECK_INDEX_VALID(workSpace, index) \
#define CHECK_INDEX_VALID(workSpace, index) \
...
@@ -196,22 +196,11 @@ static u_int32_t AddTrigger(TriggerWorkSpace *workSpace, int type, const char *n
...
@@ -196,22 +196,11 @@ static u_int32_t AddTrigger(TriggerWorkSpace *workSpace, int type, const char *n
static
int
GetTriggerIndex
(
const
char
*
type
)
static
int
GetTriggerIndex
(
const
char
*
type
)
{
{
if
(
strncmp
(
"param
"
,
type
,
strlen
(
"param
"
))
==
0
)
{
if
(
strncmp
(
"param
:"
,
type
,
strlen
(
"param:
"
))
==
0
)
{
return
TRIGGER_PROPERTY
;
return
TRIGGER_PROPERTY
;
}
else
{
return
TRIGGER_BOOT
;
}
}
static
const
char
*
triggerType
[]
=
{
"pre-init"
,
"boot"
,
"early-init"
,
"init"
,
"early-init"
,
"late-init"
,
"post-init"
,
"early-fs"
,
"post-fs"
,
"late-fs"
,
"post-fs-data"
,
"nonencrypted"
,
"firmware_mounts_complete"
,
"load_persist_params_action"
};
for
(
size_t
i
=
0
;
i
<
sizeof
(
triggerType
)
/
sizeof
(
char
*
);
i
++
)
{
if
(
strncmp
(
triggerType
[
i
],
type
,
strlen
(
triggerType
[
i
]))
==
0
)
{
return
TRIGGER_BOOT
;
}
}
return
TRIGGER_BOOT
;
}
}
static
int
CheckBootTriggerMatch
(
TriggerNode
*
trigger
,
void
*
content
,
u_int32_t
contentSize
)
static
int
CheckBootTriggerMatch
(
TriggerNode
*
trigger
,
void
*
content
,
u_int32_t
contentSize
)
...
...
services/param/trigger/trigger_processor.c
浏览文件 @
746e47cb
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
#include "uv.h"
#include "uv.h"
#define LABEL "Trigger"
#define LABEL "Trigger"
#define MAX_TRIGGER_COUNT_RUN_ONCE
1
0
#define MAX_TRIGGER_COUNT_RUN_ONCE
2
0
#define SYS_POWER_CTRL "sys.powerctrl="
#define SYS_POWER_CTRL "sys.powerctrl="
static
TriggerWorkSpace
g_triggerWorkSpace
=
{};
static
TriggerWorkSpace
g_triggerWorkSpace
=
{};
...
...
services/src/init_service.c
浏览文件 @
746e47cb
...
@@ -33,9 +33,16 @@
...
@@ -33,9 +33,16 @@
#include "init_adapter.h"
#include "init_adapter.h"
#include "init_cmds.h"
#include "init_cmds.h"
#include "init_log.h"
#include "init_log.h"
#ifndef OHOS_LITE
#include "init_param.h"
#endif
#include "init_perms.h"
#include "init_perms.h"
#include "init_service_socket.h"
#include "init_service_socket.h"
#include "init_utils.h"
#include "init_utils.h"
#include "securec.h"
#ifndef OHOS_LITE
#include "sys_param.h"
#endif
#define CAP_NUM 2
#define CAP_NUM 2
#define WAIT_MAX_COUNT 10
#define WAIT_MAX_COUNT 10
...
@@ -144,7 +151,10 @@ int ServiceStart(Service *service)
...
@@ -144,7 +151,10 @@ int ServiceStart(Service *service)
INIT_LOGE
(
"start service failed! null ptr.
\n
"
);
INIT_LOGE
(
"start service failed! null ptr.
\n
"
);
return
SERVICE_FAILURE
;
return
SERVICE_FAILURE
;
}
}
if
(
service
->
pid
>
0
)
{
INIT_LOGI
(
"service : %s had started already.
\n
"
,
service
->
name
);
return
SERVICE_SUCCESS
;
}
if
(
service
->
attribute
&
SERVICE_ATTR_INVALID
)
{
if
(
service
->
attribute
&
SERVICE_ATTR_INVALID
)
{
INIT_LOGE
(
"start service %s invalid.
\n
"
,
service
->
name
);
INIT_LOGE
(
"start service %s invalid.
\n
"
,
service
->
name
);
return
SERVICE_FAILURE
;
return
SERVICE_FAILURE
;
...
@@ -220,6 +230,13 @@ int ServiceStart(Service *service)
...
@@ -220,6 +230,13 @@ int ServiceStart(Service *service)
}
}
service
->
pid
=
pid
;
service
->
pid
=
pid
;
#ifndef OHOS_LITE
char
paramName
[
PARAM_NAME_LEN_MAX
]
=
{
0
};
if
(
snprintf_s
(
paramName
,
PARAM_NAME_LEN_MAX
,
PARAM_NAME_LEN_MAX
-
1
,
"init.svc.%s"
,
service
->
name
)
<
0
)
{
INIT_LOGE
(
"snprintf_s paramName error %d
\n
"
,
errno
);
}
SystemWriteParam
(
paramName
,
"running"
);
#endif
return
SERVICE_SUCCESS
;
return
SERVICE_SUCCESS
;
}
}
...
@@ -240,7 +257,13 @@ int ServiceStop(Service *service)
...
@@ -240,7 +257,13 @@ int ServiceStop(Service *service)
INIT_LOGE
(
"stop service %s pid %d failed! err %d.
\n
"
,
service
->
name
,
service
->
pid
,
errno
);
INIT_LOGE
(
"stop service %s pid %d failed! err %d.
\n
"
,
service
->
name
,
service
->
pid
,
errno
);
return
SERVICE_FAILURE
;
return
SERVICE_FAILURE
;
}
}
#ifndef OHOS_LITE
char
paramName
[
PARAM_NAME_LEN_MAX
]
=
{
0
};
if
(
snprintf_s
(
paramName
,
PARAM_NAME_LEN_MAX
,
PARAM_NAME_LEN_MAX
-
1
,
"init.svc.%s"
,
service
->
name
)
<
0
)
{
INIT_LOGE
(
"snprintf_s paramName error %d
\n
"
,
errno
);
}
SystemWriteParam
(
paramName
,
"stopping"
);
#endif
INIT_LOGI
(
"stop service %s, pid %d.
\n
"
,
service
->
name
,
service
->
pid
);
INIT_LOGI
(
"stop service %s, pid %d.
\n
"
,
service
->
name
,
service
->
pid
);
return
SERVICE_SUCCESS
;
return
SERVICE_SUCCESS
;
}
}
...
@@ -291,12 +314,19 @@ void ServiceReap(Service *service)
...
@@ -291,12 +314,19 @@ void ServiceReap(Service *service)
return
;
return
;
}
}
service
->
pid
=
-
1
;
#ifndef OHOS_LITE
char
paramName
[
PARAM_NAME_LEN_MAX
]
=
{
0
};
if
(
snprintf_s
(
paramName
,
PARAM_NAME_LEN_MAX
,
PARAM_NAME_LEN_MAX
-
1
,
"init.svc.%s"
,
service
->
name
)
<
0
)
{
INIT_LOGE
(
"snprintf_s paramName error %d
\n
"
,
errno
);
}
SystemWriteParam
(
paramName
,
"stopped"
);
#endif
if
(
service
->
attribute
&
SERVICE_ATTR_INVALID
)
{
if
(
service
->
attribute
&
SERVICE_ATTR_INVALID
)
{
INIT_LOGE
(
"ServiceReap service %s invalid.
\n
"
,
service
->
name
);
INIT_LOGE
(
"ServiceReap service %s invalid.
\n
"
,
service
->
name
);
return
;
return
;
}
}
service
->
pid
=
-
1
;
// stopped by system-init itself, no need to restart even if it is not one-shot service
// stopped by system-init itself, no need to restart even if it is not one-shot service
if
(
service
->
attribute
&
SERVICE_ATTR_NEED_STOP
)
{
if
(
service
->
attribute
&
SERVICE_ATTR_NEED_STOP
)
{
service
->
attribute
&=
(
~
SERVICE_ATTR_NEED_STOP
);
service
->
attribute
&=
(
~
SERVICE_ATTR_NEED_STOP
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录