Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
f78490d2
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看板
提交
f78490d2
编写于
7月 16, 2021
作者:
O
openharmony_ci
提交者:
Gitee
7月 16, 2021
浏览文件
操作
浏览文件
下载
差异文件
!58 修改L2 init
Merge pull request !58 from 熊磊/init07155
上级
852ef76c
6eba03cb
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
41 addition
and
33 deletion
+41
-33
services/etc/init.cfg
services/etc/init.cfg
+4
-1
services/etc/init.usb.configfs.cfg
services/etc/init.usb.configfs.cfg
+16
-16
services/log/init_log.h
services/log/init_log.h
+3
-0
services/param/client/param_request.c
services/param/client/param_request.c
+7
-7
services/param/include/param_manager.h
services/param/include/param_manager.h
+1
-0
services/param/manager/param_trie.c
services/param/manager/param_trie.c
+2
-2
services/param/service/param_service.c
services/param/service/param_service.c
+2
-2
services/param/trigger/trigger_manager.c
services/param/trigger/trigger_manager.c
+2
-2
services/param/trigger/trigger_processor.c
services/param/trigger/trigger_processor.c
+3
-3
services/src/init_read_cfg.c
services/src/init_read_cfg.c
+1
-0
未找到文件。
services/etc/init.cfg
浏览文件 @
f78490d2
...
...
@@ -28,6 +28,9 @@
}, {
"name" : "init",
"cmds" : [
"load_param /vendor/build.prop",
"load_param /vendor/default.prop",
"load_param /vendor/odm/etc/build.prop",
"copy /proc/cmdline /dev/urandom",
"copy /system/etc/prop.default /dev/urandom",
"symlink /proc/self/fd/0 /dev/stdin",
...
...
@@ -174,7 +177,7 @@
"export DOWNLOAD_CACHE /data/cache",
"setrlimit RLIMIT_NICE 40 40",
"setrlimit RLIMIT_NOFILE 32768 32768",
"write /sys/class/leds/vibrator/trigger
\"transient\"
",
"write /sys/class/leds/vibrator/trigger
transient
",
"write /dev/cpu_variant:${ro.bionic.arch} ${ro.bionic.cpu_variant}",
"chmod 0444 /dev/cpu_variant:${ro.bionic.arch}",
"write /dev/cpu_variant:${ro.bionic.2nd_arch} ${ro.bionic.2nd_cpu_variant}",
...
...
services/etc/init.usb.configfs.cfg
浏览文件 @
f78490d2
...
...
@@ -3,7 +3,7 @@
"name" : "param:sys.usb.config=none && param:sys.usb.configfs=1",
"condition" : "sys.usb.config=none && sys.usb.configfs=1",
"cmds" : [
"write /config/usb_gadget/g1/UDC
\"none\"
",
"write /config/usb_gadget/g1/UDC
none
",
"stop adbd",
"setparam sys.usb.ffs.ready 0",
"write /config/usb_gadget/g1/bDeviceClass 0",
...
...
@@ -31,7 +31,7 @@
"name" : "param: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",
"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
",
"symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1",
"write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
"setparam sys.usb.state ${sys.usb.config}"
...
...
@@ -40,7 +40,7 @@
"name" : "param:sys.usb.config=mtp && param:sys.usb.configfs=1",
"condition" : "sys.usb.config=mtp && sys.usb.configfs=1",
"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
",
"symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1",
"write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
"setparam sys.usb.state ${sys.usb.config}"
...
...
@@ -55,7 +55,7 @@
"name" : "param: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",
"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
",
"symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1",
"symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2",
"write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
...
...
@@ -65,7 +65,7 @@
"name" : "param:sys.usb.config=ptp && param:sys.usb.configfs=1",
"condition" : "sys.usb.config=ptp && sys.usb.configfs=1",
"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
",
"symlink /config/usb_gadget/g1/functions/ptp.gs1 /config/usb_gadget/g1/configs/b.1/f1",
"write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
"setparam sys.usb.state ${sys.usb.config}"
...
...
@@ -80,7 +80,7 @@
"name" : "param: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",
"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
",
"symlink /config/usb_gadget/g1/functions/ptp.gs1 /config/usb_gadget/g1/configs/b.1/f1",
"symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2",
"write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
...
...
@@ -90,7 +90,7 @@
"name" : "param:sys.usb.config=accessory && param:sys.usb.configfs=1",
"condition" : "sys.usb.config=accessory && sys.usb.configfs=1",
"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
",
"symlink /config/usb_gadget/g1/functions/accessory.gs2 /config/usb_gadget/g1/configs/b.1/f1",
"write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
"setparam sys.usb.state ${sys.usb.config}"
...
...
@@ -105,7 +105,7 @@
"name" : "param: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",
"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
",
"symlink /config/usb_gadget/g1/functions/accessory.gs2 /config/usb_gadget/g1/configs/b.1/f1",
"symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2",
"write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
...
...
@@ -115,7 +115,7 @@
"name" : "param:sys.usb.config=audio_source && param:sys.usb.configfs=1",
"condition" : "sys.usb.config=audio_source && sys.usb.configfs=1",
"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
",
"symlink /config/usb_gadget/g1/functions/audio_source.gs3 /config/usb_gadget/g1/configs/b.1/f1",
"write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
"setparam sys.usb.state ${sys.usb.config}"
...
...
@@ -130,7 +130,7 @@
"name" : "param: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",
"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
",
"symlink /config/usb_gadget/g1/functions/audio_source.gs3 /config/usb_gadget/g1/configs/b.1/f1",
"symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2",
"write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
...
...
@@ -140,7 +140,7 @@
"name" : "param:sys.usb.config=accessory,audio_source && param:sys.usb.configfs=1",
"condition" : "sys.usb.config=accessory,audio_source && sys.usb.configfs=1",
"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
",
"symlink /config/usb_gadget/g1/functions/accessory.gs2 /config/usb_gadget/g1/configs/b.1/f1",
"symlink /config/usb_gadget/g1/functions/audio_source.gs3 /config/usb_gadget/g1/configs/b.1/f2",
"write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
...
...
@@ -156,7 +156,7 @@
"name" : "param: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",
"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
",
"symlink /config/usb_gadget/g1/functions/accessory.gs2 /config/usb_gadget/g1/configs/b.1/f1",
"symlink /config/usb_gadget/g1/functions/audio_source.gs3 /config/usb_gadget/g1/configs/b.1/f2",
"symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f3",
...
...
@@ -167,7 +167,7 @@
"name" : "param:sys.usb.config=midi && param:sys.usb.configfs=1",
"condition" : "sys.usb.config=midi && sys.usb.configfs=1",
"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
",
"symlink /config/usb_gadget/g1/functions/midi.gs5 /config/usb_gadget/g1/configs/b.1/f1",
"write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
"setparam sys.usb.state ${sys.usb.config}"
...
...
@@ -182,7 +182,7 @@
"name" : "param: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",
"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
",
"symlink /config/usb_gadget/g1/functions/midi.gs5 /config/usb_gadget/g1/configs/b.1/f1",
"symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2",
"write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
...
...
@@ -193,7 +193,7 @@
"condition" : "sys.usb.config=rndis && sys.usb.configfs=1",
"cmds" : [
"mkdir /config/usb_gadget/g1/functions/rndis.gs4",
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration
\"rndis\"
",
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration
rndis
",
"symlink /config/usb_gadget/g1/functions/rndis.gs4 /config/usb_gadget/g1/configs/b.1/f1",
"write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
"setparam sys.usb.state ${sys.usb.config}"
...
...
@@ -209,7 +209,7 @@
"condition" : "sys.usb.ffs.ready=1 && sys.usb.config=rndis,adb && sys.usb.configfs=1",
"cmds" : [
"mkdir /config/usb_gadget/g1/functions/rndis.gs4",
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration
\"rndis_adb\"
",
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration
rndis_adb
",
"symlink /config/usb_gadget/g1/functions/rndis.gs4 /config/usb_gadget/g1/configs/b.1/f1",
"symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2",
"write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
...
...
services/log/init_log.h
浏览文件 @
f78490d2
...
...
@@ -50,9 +50,11 @@ typedef enum InitLogLevel {
#define INIT_LOGE(fmt, ...) InitToHiLog(INIT_LOG_TAG, LOG_ERROR, "%s : "fmt, (__FUNCTION__), ##__VA_ARGS__)
#define INIT_LOGF(fmt, ...) InitToHiLog(INIT_LOG_TAG, LOG_FATAL, "%s : "fmt, (__FUNCTION__), ##__VA_ARGS__)
#define STARTUP_LOGD(LABEL, fmt, ...) InitToHiLog(LABEL, LOG_DEBUG, "%s : "fmt, (__FUNCTION__), ##__VA_ARGS__)
#define STARTUP_LOGI(LABEL, fmt, ...) InitToHiLog(LABEL, LOG_INFO, "%s : "fmt, (__FUNCTION__), ##__VA_ARGS__)
#define STARTUP_LOGE(LABEL, fmt, ...) InitToHiLog(LABEL, LOG_ERROR, "%s : "fmt, (__FUNCTION__), ##__VA_ARGS__)
void
InitToHiLog
(
const
char
*
tag
,
LogLevel
logLevel
,
const
char
*
fmt
,
...);
void
SetHiLogLevel
(
LogLevel
logLevel
);
...
...
@@ -64,6 +66,7 @@ void SetHiLogLevel(LogLevel logLevel);
#define INIT_LOGE(fmt, ...) InitLog(INIT_LOG_TAG, INIT_ERROR, (__FILE_NAME__), (__LINE__), fmt"\n", ##__VA_ARGS__)
#define INIT_LOGF(fmt, ...) InitLog(INIT_LOG_TAG, INIT_FATAL, (__FILE_NAME__), (__LINE__), fmt"\n", ##__VA_ARGS__)
#define STARTUP_LOGD(LABEL, fmt, ...) InitLog(LABEL, INIT_DEBUG, (__FILE_NAME__), (__LINE__), fmt "\n", ##__VA_ARGS__)
#define STARTUP_LOGI(LABEL, fmt, ...) InitLog(LABEL, INIT_INFO, (__FILE_NAME__), (__LINE__), fmt "\n", ##__VA_ARGS__)
#define STARTUP_LOGE(LABEL, fmt, ...) InitLog(LABEL, INIT_ERROR, (__FILE_NAME__), (__LINE__), fmt "\n", ##__VA_ARGS__)
...
...
services/param/client/param_request.c
浏览文件 @
f78490d2
...
...
@@ -30,7 +30,7 @@ static ParamWorkSpace g_paramWorkSpaceReadOnly = {ATOMIC_VAR_INIT(0), {}, {}, {}
static
void
OnWrite
(
uv_write_t
*
req
,
int
status
)
{
PARAM_LOG
I
(
"OnWrite status %d"
,
status
);
PARAM_LOG
D
(
"OnWrite status %d"
,
status
);
}
static
void
OnReceiveAlloc
(
uv_handle_t
*
handle
,
size_t
suggestedSize
,
uv_buf_t
*
buf
)
...
...
@@ -38,13 +38,13 @@ static void OnReceiveAlloc(uv_handle_t* handle, size_t suggestedSize, uv_buf_t*
// 这里需要按实际回复大小申请内存,不需要大内存
buf
->
base
=
(
char
*
)
malloc
(
sizeof
(
ResponseMsg
));
buf
->
len
=
sizeof
(
ResponseMsg
);
PARAM_LOG
I
(
"OnReceiveAlloc handle %p %zu"
,
handle
,
suggestedSize
);
PARAM_LOG
D
(
"OnReceiveAlloc handle %p %zu"
,
handle
,
suggestedSize
);
}
static
void
OnReceiveResponse
(
uv_stream_t
*
handle
,
ssize_t
nread
,
const
uv_buf_t
*
buf
)
{
RequestNode
*
req
=
ParamEntry
(
handle
,
RequestNode
,
handle
);
PARAM_LOG
I
(
"OnReceiveResponse %p"
,
handle
);
PARAM_LOG
D
(
"OnReceiveResponse %p"
,
handle
);
if
(
nread
<=
0
||
buf
==
NULL
||
handle
==
NULL
||
buf
->
base
==
NULL
)
{
if
(
buf
!=
NULL
&&
buf
->
base
!=
NULL
)
{
free
(
buf
->
base
);
...
...
@@ -57,7 +57,7 @@ static void OnReceiveResponse(uv_stream_t *handle, ssize_t nread, const uv_buf_t
}
ResponseMsg
*
response
=
(
ResponseMsg
*
)(
buf
->
base
);
PARAM_CHECK
(
response
!=
NULL
,
return
,
"The response is null"
);
PARAM_LOG
I
(
"OnReceiveResponse %p cmd %d result: %d"
,
handle
,
response
->
type
,
response
->
result
);
PARAM_LOG
D
(
"OnReceiveResponse %p cmd %d result: %d"
,
handle
,
response
->
type
,
response
->
result
);
switch
(
response
->
type
)
{
case
SET_PARAM
:
req
->
result
=
response
->
result
;
...
...
@@ -66,7 +66,7 @@ static void OnReceiveResponse(uv_stream_t *handle, ssize_t nread, const uv_buf_t
PARAM_LOGE
(
"not supported the command: %d"
,
response
->
type
);
break
;
}
PARAM_LOG
E
(
"Close handle %p"
,
handle
);
PARAM_LOG
D
(
"Close handle %p"
,
handle
);
free
(
buf
->
base
);
uv_close
((
uv_handle_t
*
)
handle
,
NULL
);
uv_stop
(
req
->
loop
);
...
...
@@ -76,7 +76,7 @@ static void OnConnection(uv_connect_t *connect, int status)
{
PARAM_CHECK
(
status
>=
0
,
return
,
"Failed to conntect status %s"
,
uv_strerror
(
status
));
RequestNode
*
request
=
ParamEntry
(
connect
,
RequestNode
,
connect
);
PARAM_LOG
I
(
"Connect to server handle %p"
,
&
(
request
->
handle
));
PARAM_LOG
D
(
"Connect to server handle %p"
,
&
(
request
->
handle
));
uv_buf_t
buf
=
uv_buf_init
((
char
*
)
&
request
->
msg
,
request
->
msg
.
contentSize
+
sizeof
(
request
->
msg
));
int
ret
=
uv_write2
(
&
request
->
wr
,
(
uv_stream_t
*
)
&
(
request
->
handle
),
&
buf
,
1
,
(
uv_stream_t
*
)
&
(
request
->
handle
),
OnWrite
);
PARAM_CHECK
(
ret
>=
0
,
return
,
"Failed to uv_write2 porperty"
);
...
...
@@ -107,7 +107,7 @@ int SystemSetParameter(const char *name, const char *value)
int
ret
=
CheckParamName
(
name
,
0
);
PARAM_CHECK
(
ret
==
0
,
return
ret
,
"Illegal param name"
);
PARAM_LOG
I
(
"StartRequest %s"
,
name
);
PARAM_LOG
D
(
"StartRequest %s"
,
name
);
u_int32_t
msgSize
=
sizeof
(
RequestMsg
)
+
strlen
(
name
)
+
strlen
(
value
)
+
2
;
RequestNode
*
request
=
(
RequestNode
*
)
malloc
(
sizeof
(
RequestNode
)
+
msgSize
);
PARAM_CHECK
(
request
!=
NULL
,
return
-
1
,
"Failed to malloc for connect"
);
...
...
services/param/include/param_manager.h
浏览文件 @
f78490d2
...
...
@@ -66,6 +66,7 @@ typedef enum {
#define PARAM_LOGI(fmt, ...) STARTUP_LOGI(LABEL, fmt, ##__VA_ARGS__)
#define PARAM_LOGE(fmt, ...) STARTUP_LOGE(LABEL, fmt, ##__VA_ARGS__)
#define PARAM_LOGD(fmt, ...) STARTUP_LOGD(LABEL, fmt, ##__VA_ARGS__)
#define PARAM_CHECK(retCode, exper, ...) \
if
(
!
(
retCode
))
{
\
...
...
services/param/manager/param_trie.c
浏览文件 @
f78490d2
...
...
@@ -82,7 +82,7 @@ int InitWorkSpace_(WorkSpace *workSpace, int mode, int prot, u_int32_t spaceSize
return
PARAM_CODE_INVALID_PARAM
,
"Invalid param %s"
,
workSpace
->
fileName
);
PARAM_CHECK
(
workSpace
->
compareTrieNode
!=
NULL
,
return
PARAM_CODE_INVALID_PARAM
,
"Invalid param %s"
,
workSpace
->
fileName
);
PARAM_LOG
I
(
"InitWorkSpace %s "
,
workSpace
->
fileName
);
PARAM_LOG
D
(
"InitWorkSpace %s "
,
workSpace
->
fileName
);
CheckAndCreateDir
(
workSpace
->
fileName
);
int
fd
=
open
(
workSpace
->
fileName
,
mode
,
00777
);
//0444);
...
...
@@ -111,7 +111,7 @@ int InitWorkSpace_(WorkSpace *workSpace, int mode, int prot, u_int32_t spaceSize
workSpace
->
area
=
(
WorkArea
*
)
areaAddr
;
workSpace
->
rootNode
=
GetTrieNode
(
workSpace
,
&
workSpace
->
area
->
firstNode
);
}
PARAM_LOG
I
(
"InitWorkSpace success, readOnly %d currOffset %u firstNode %u dataSize %u"
,
PARAM_LOG
D
(
"InitWorkSpace success, readOnly %d currOffset %u firstNode %u dataSize %u"
,
readOnly
,
workSpace
->
area
->
currOffset
,
workSpace
->
area
->
firstNode
,
workSpace
->
area
->
dataSize
);
return
0
;
}
...
...
services/param/service/param_service.c
浏览文件 @
f78490d2
...
...
@@ -110,7 +110,7 @@ static int ProcessParamSet(RequestMsg *msg)
int
ret
=
GetSubStringInfo
(
msg
->
content
,
msg
->
contentSize
,
'='
,
info
,
sizeof
(
info
)
/
sizeof
(
info
[
0
]));
PARAM_CHECK
(
ret
>=
2
,
return
ret
,
"Failed to get name from content %s"
,
msg
->
content
);
PARAM_LOG
I
(
"ProcessParamSet name %s value: %s"
,
info
[
0
].
value
,
info
[
1
].
value
);
PARAM_LOG
D
(
"ProcessParamSet name %s value: %s"
,
info
[
0
].
value
,
info
[
1
].
value
);
ret
=
WriteParamWithCheck
(
&
g_paramWorkSpace
,
&
msg
->
securitylabel
,
info
[
0
].
value
,
info
[
1
].
value
);
PARAM_CHECK
(
ret
==
0
,
return
ret
,
"Failed to set param %d name %s %s"
,
ret
,
info
[
0
].
value
,
info
[
1
].
value
);
ret
=
WritePersistParam
(
info
[
0
].
value
,
info
[
1
].
value
);
...
...
@@ -135,7 +135,7 @@ static void OnReceiveAlloc(uv_handle_t *handle, size_t suggestedSize, uv_buf_t*
static
void
OnWriteResponse
(
uv_write_t
*
req
,
int
status
)
{
// 发送成功,释放请求内存
PARAM_LOG
I
(
"OnWriteResponse status %d"
,
status
);
PARAM_LOG
D
(
"OnWriteResponse status %d"
,
status
);
ResponseNode
*
node
=
(
ResponseNode
*
)
req
;
free
(
node
);
}
...
...
services/param/trigger/trigger_manager.c
浏览文件 @
f78490d2
...
...
@@ -228,7 +228,7 @@ int ParseTrigger(TriggerWorkSpace *workSpace, cJSON *triggerItem)
PARAM_LOGE
(
"Warning parseTrigger %s %s"
,
name
,
condition
);
}
}
PARAM_LOG
I
(
"ParseTrigger %s %u"
,
name
,
offset
);
PARAM_LOG
D
(
"ParseTrigger %s %u"
,
name
,
offset
);
// 添加命令行
cJSON
*
cmdItems
=
cJSON_GetObjectItem
(
triggerItem
,
CMDS_ARR_NAME_IN_JSON
);
...
...
@@ -332,7 +332,7 @@ static int CheckTrigger_(TriggerWorkSpace *workSpace,
static
TRIGGER_MATCH
triggerCheckMatch
[
TRIGGER_MAX
]
=
{
CheckBootTriggerMatch
,
CheckParamTriggerMatch
,
CheckOtherTriggerMatch
};
PARAM_LOG
I
(
"CheckTrigger_ content %s "
,
content
);
PARAM_LOG
D
(
"CheckTrigger_ content %s "
,
content
);
PARAM_CHECK
(
calculator
!=
NULL
,
return
-
1
,
"Failed to check calculator"
);
PARAM_CHECK
(
CHECK_INDEX_VALID
(
workSpace
,
type
),
return
-
1
,
"Invalid type %d"
,
type
);
PARAM_CHECK
((
u_int32_t
)
type
<
sizeof
(
triggerCheckMatch
)
/
sizeof
(
triggerCheckMatch
[
0
]),
...
...
services/param/trigger/trigger_processor.c
浏览文件 @
f78490d2
...
...
@@ -30,7 +30,7 @@ static TriggerWorkSpace g_triggerWorkSpace = {};
static
int
DoCmdExecute
(
TriggerNode
*
trigger
,
const
char
*
cmdName
,
const
char
*
command
)
{
PARAM_CHECK
(
trigger
!=
NULL
&&
cmdName
!=
NULL
&&
command
!=
NULL
,
return
-
1
,
"Invalid param"
);
PARAM_LOG
I
(
"DoCmdExecute trigger %s cmd %s %s"
,
trigger
->
name
,
cmdName
,
command
);
PARAM_LOG
D
(
"DoCmdExecute trigger %s cmd %s %s"
,
trigger
->
name
,
cmdName
,
command
);
if
(
strncmp
(
cmdName
,
TRIGGER_CMD
,
strlen
(
TRIGGER_CMD
))
==
0
)
{
DoTriggerExec
(
command
);
return
0
;
...
...
@@ -155,7 +155,7 @@ void PostParamTrigger(const char *name, const char *value)
void
PostTrigger
(
EventType
type
,
const
char
*
content
,
u_int32_t
contentLen
)
{
PARAM_LOG
I
(
"PostTrigger %d %s"
,
type
,
content
);
PARAM_LOG
D
(
"PostTrigger %d %s"
,
type
,
content
);
PARAM_CHECK
(
content
!=
NULL
&&
contentLen
>
0
,
return
,
"Invalid param"
);
TriggerDataEvent
*
event
=
(
TriggerDataEvent
*
)
malloc
(
sizeof
(
TriggerDataEvent
)
+
contentLen
+
1
);
PARAM_CHECK
(
event
!=
NULL
,
return
,
"Failed to alloc memory"
);
...
...
@@ -165,7 +165,7 @@ void PostTrigger(EventType type, const char *content, u_int32_t contentLen)
memcpy_s
(
event
->
content
,
contentLen
,
content
,
contentLen
);
event
->
content
[
contentLen
]
=
'\0'
;
SendTriggerEvent
(
event
);
PARAM_LOG
I
(
"PostTrigger %d success"
,
type
);
PARAM_LOG
D
(
"PostTrigger %d success"
,
type
);
}
int
ParseTriggerConfig
(
cJSON
*
fileRoot
)
...
...
services/src/init_read_cfg.c
浏览文件 @
f78490d2
...
...
@@ -124,6 +124,7 @@ void InitReadCfg()
LoadDefaultParams
(
"/system/etc/prop.default"
);
LoadDefaultParams
(
"/system/build.prop"
);
LoadDefaultParams
(
"/system/buildz.prop"
);
LoadDefaultParams
(
"/product/build.prop"
);
#endif
ParseInitCfg
(
INIT_CONFIGURATION_FILE
);
ParseOtherCfgs
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录