提交 f78490d2 编写于 作者: O openharmony_ci 提交者: Gitee

!58 修改L2 init

Merge pull request !58 from 熊磊/init07155
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
}, { }, {
"name" : "init", "name" : "init",
"cmds" : [ "cmds" : [
"load_param /vendor/build.prop",
"load_param /vendor/default.prop",
"load_param /vendor/odm/etc/build.prop",
"copy /proc/cmdline /dev/urandom", "copy /proc/cmdline /dev/urandom",
"copy /system/etc/prop.default /dev/urandom", "copy /system/etc/prop.default /dev/urandom",
"symlink /proc/self/fd/0 /dev/stdin", "symlink /proc/self/fd/0 /dev/stdin",
...@@ -174,7 +177,7 @@ ...@@ -174,7 +177,7 @@
"export DOWNLOAD_CACHE /data/cache", "export DOWNLOAD_CACHE /data/cache",
"setrlimit RLIMIT_NICE 40 40", "setrlimit RLIMIT_NICE 40 40",
"setrlimit RLIMIT_NOFILE 32768 32768", "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}", "write /dev/cpu_variant:${ro.bionic.arch} ${ro.bionic.cpu_variant}",
"chmod 0444 /dev/cpu_variant:${ro.bionic.arch}", "chmod 0444 /dev/cpu_variant:${ro.bionic.arch}",
"write /dev/cpu_variant:${ro.bionic.2nd_arch} ${ro.bionic.2nd_cpu_variant}", "write /dev/cpu_variant:${ro.bionic.2nd_arch} ${ro.bionic.2nd_cpu_variant}",
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"name" : "param:sys.usb.config=none && param:sys.usb.configfs=1", "name" : "param: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",
"stop adbd", "stop adbd",
"setparam sys.usb.ffs.ready 0", "setparam sys.usb.ffs.ready 0",
"write /config/usb_gadget/g1/bDeviceClass 0", "write /config/usb_gadget/g1/bDeviceClass 0",
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
"name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=adb && param:sys.usb.configfs=1", "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", "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",
"symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1", "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}", "write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
"name" : "param:sys.usb.config=mtp && param:sys.usb.configfs=1", "name" : "param: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",
"symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1", "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}", "write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
"name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=mtp,adb && param:sys.usb.configfs=1", "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", "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",
"symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1", "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", "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}", "write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
"name" : "param:sys.usb.config=ptp && param:sys.usb.configfs=1", "name" : "param: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",
"symlink /config/usb_gadget/g1/functions/ptp.gs1 /config/usb_gadget/g1/configs/b.1/f1", "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}", "write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
"name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=ptp,adb && param:sys.usb.configfs=1", "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", "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",
"symlink /config/usb_gadget/g1/functions/ptp.gs1 /config/usb_gadget/g1/configs/b.1/f1", "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", "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}", "write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
"name" : "param:sys.usb.config=accessory && param:sys.usb.configfs=1", "name" : "param: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",
"symlink /config/usb_gadget/g1/functions/accessory.gs2 /config/usb_gadget/g1/configs/b.1/f1", "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}", "write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
"name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=accessory,adb && param:sys.usb.configfs=1", "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", "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",
"symlink /config/usb_gadget/g1/functions/accessory.gs2 /config/usb_gadget/g1/configs/b.1/f1", "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", "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}", "write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
"name" : "param:sys.usb.config=audio_source && param:sys.usb.configfs=1", "name" : "param: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",
"symlink /config/usb_gadget/g1/functions/audio_source.gs3 /config/usb_gadget/g1/configs/b.1/f1", "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}", "write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
"name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=audio_source,adb && param:sys.usb.configfs=1", "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", "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",
"symlink /config/usb_gadget/g1/functions/audio_source.gs3 /config/usb_gadget/g1/configs/b.1/f1", "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", "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}", "write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
...@@ -140,7 +140,7 @@ ...@@ -140,7 +140,7 @@
"name" : "param:sys.usb.config=accessory,audio_source && param:sys.usb.configfs=1", "name" : "param: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",
"symlink /config/usb_gadget/g1/functions/accessory.gs2 /config/usb_gadget/g1/configs/b.1/f1", "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/audio_source.gs3 /config/usb_gadget/g1/configs/b.1/f2",
"write /config/usb_gadget/g1/UDC ${sys.usb.controller}", "write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
...@@ -156,7 +156,7 @@ ...@@ -156,7 +156,7 @@
"name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=accessory,audio_source,adb && param:sys.usb.configfs=1", "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", "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",
"symlink /config/usb_gadget/g1/functions/accessory.gs2 /config/usb_gadget/g1/configs/b.1/f1", "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/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", "symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f3",
...@@ -167,7 +167,7 @@ ...@@ -167,7 +167,7 @@
"name" : "param:sys.usb.config=midi && param:sys.usb.configfs=1", "name" : "param: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",
"symlink /config/usb_gadget/g1/functions/midi.gs5 /config/usb_gadget/g1/configs/b.1/f1", "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}", "write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
...@@ -182,7 +182,7 @@ ...@@ -182,7 +182,7 @@
"name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=midi,adb && param:sys.usb.configfs=1", "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", "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",
"symlink /config/usb_gadget/g1/functions/midi.gs5 /config/usb_gadget/g1/configs/b.1/f1", "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", "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}", "write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
...@@ -193,7 +193,7 @@ ...@@ -193,7 +193,7 @@
"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",
"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", "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}", "write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
...@@ -209,7 +209,7 @@ ...@@ -209,7 +209,7 @@
"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",
"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/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", "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}", "write /config/usb_gadget/g1/UDC ${sys.usb.controller}",
......
...@@ -50,9 +50,11 @@ typedef enum InitLogLevel { ...@@ -50,9 +50,11 @@ typedef enum InitLogLevel {
#define INIT_LOGE(fmt, ...) InitToHiLog(INIT_LOG_TAG, LOG_ERROR, "%s : "fmt, (__FUNCTION__), ##__VA_ARGS__) #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 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_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__) #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 InitToHiLog(const char *tag, LogLevel logLevel, const char *fmt, ...);
void SetHiLogLevel(LogLevel logLevel); void SetHiLogLevel(LogLevel logLevel);
...@@ -64,6 +66,7 @@ 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_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 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_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__) #define STARTUP_LOGE(LABEL, fmt, ...) InitLog(LABEL, INIT_ERROR, (__FILE_NAME__), (__LINE__), fmt "\n", ##__VA_ARGS__)
......
...@@ -30,7 +30,7 @@ static ParamWorkSpace g_paramWorkSpaceReadOnly = {ATOMIC_VAR_INIT(0), {}, {}, {} ...@@ -30,7 +30,7 @@ static ParamWorkSpace g_paramWorkSpaceReadOnly = {ATOMIC_VAR_INIT(0), {}, {}, {}
static void OnWrite(uv_write_t *req, int status) static void OnWrite(uv_write_t *req, int status)
{ {
PARAM_LOGI("OnWrite status %d", status); PARAM_LOGD("OnWrite status %d", status);
} }
static void OnReceiveAlloc(uv_handle_t* handle, size_t suggestedSize, uv_buf_t* buf) 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* ...@@ -38,13 +38,13 @@ static void OnReceiveAlloc(uv_handle_t* handle, size_t suggestedSize, uv_buf_t*
// 这里需要按实际回复大小申请内存,不需要大内存 // 这里需要按实际回复大小申请内存,不需要大内存
buf->base = (char *)malloc(sizeof(ResponseMsg)); buf->base = (char *)malloc(sizeof(ResponseMsg));
buf->len = sizeof(ResponseMsg); buf->len = sizeof(ResponseMsg);
PARAM_LOGI("OnReceiveAlloc handle %p %zu", handle, suggestedSize); PARAM_LOGD("OnReceiveAlloc handle %p %zu", handle, suggestedSize);
} }
static void OnReceiveResponse(uv_stream_t *handle, ssize_t nread, const uv_buf_t *buf) static void OnReceiveResponse(uv_stream_t *handle, ssize_t nread, const uv_buf_t *buf)
{ {
RequestNode *req = ParamEntry(handle, RequestNode, handle); RequestNode *req = ParamEntry(handle, RequestNode, handle);
PARAM_LOGI("OnReceiveResponse %p", handle); PARAM_LOGD("OnReceiveResponse %p", handle);
if (nread <= 0 || buf == NULL || handle == NULL || buf->base == NULL) { if (nread <= 0 || buf == NULL || handle == NULL || buf->base == NULL) {
if (buf != NULL && buf->base != NULL) { if (buf != NULL && buf->base != NULL) {
free(buf->base); free(buf->base);
...@@ -57,7 +57,7 @@ static void OnReceiveResponse(uv_stream_t *handle, ssize_t nread, const uv_buf_t ...@@ -57,7 +57,7 @@ static void OnReceiveResponse(uv_stream_t *handle, ssize_t nread, const uv_buf_t
} }
ResponseMsg *response = (ResponseMsg *)(buf->base); ResponseMsg *response = (ResponseMsg *)(buf->base);
PARAM_CHECK(response != NULL, return, "The response is null"); PARAM_CHECK(response != NULL, return, "The response is null");
PARAM_LOGI("OnReceiveResponse %p cmd %d result: %d", handle, response->type, response->result); PARAM_LOGD("OnReceiveResponse %p cmd %d result: %d", handle, response->type, response->result);
switch (response->type) { switch (response->type) {
case SET_PARAM: case SET_PARAM:
req->result = response->result; req->result = response->result;
...@@ -66,7 +66,7 @@ static void OnReceiveResponse(uv_stream_t *handle, ssize_t nread, const uv_buf_t ...@@ -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); PARAM_LOGE("not supported the command: %d", response->type);
break; break;
} }
PARAM_LOGE("Close handle %p", handle); PARAM_LOGD("Close handle %p", handle);
free(buf->base); free(buf->base);
uv_close((uv_handle_t*)handle, NULL); uv_close((uv_handle_t*)handle, NULL);
uv_stop(req->loop); uv_stop(req->loop);
...@@ -76,7 +76,7 @@ static void OnConnection(uv_connect_t *connect, int status) ...@@ -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)); PARAM_CHECK(status >= 0, return, "Failed to conntect status %s", uv_strerror(status));
RequestNode *request = ParamEntry(connect, RequestNode, connect); RequestNode *request = ParamEntry(connect, RequestNode, connect);
PARAM_LOGI("Connect to server handle %p", &(request->handle)); PARAM_LOGD("Connect to server handle %p", &(request->handle));
uv_buf_t buf = uv_buf_init((char*)&request->msg, request->msg.contentSize + sizeof(request->msg)); 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); 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"); PARAM_CHECK(ret >= 0, return, "Failed to uv_write2 porperty");
...@@ -107,7 +107,7 @@ int SystemSetParameter(const char *name, const char *value) ...@@ -107,7 +107,7 @@ int SystemSetParameter(const char *name, const char *value)
int ret = CheckParamName(name, 0); int ret = CheckParamName(name, 0);
PARAM_CHECK(ret == 0, return ret, "Illegal param name"); PARAM_CHECK(ret == 0, return ret, "Illegal param name");
PARAM_LOGI("StartRequest %s", name); PARAM_LOGD("StartRequest %s", name);
u_int32_t msgSize = sizeof(RequestMsg) + strlen(name) + strlen(value) + 2; u_int32_t msgSize = sizeof(RequestMsg) + strlen(name) + strlen(value) + 2;
RequestNode *request = (RequestNode *)malloc(sizeof(RequestNode) + msgSize); RequestNode *request = (RequestNode *)malloc(sizeof(RequestNode) + msgSize);
PARAM_CHECK(request != NULL, return -1, "Failed to malloc for connect"); PARAM_CHECK(request != NULL, return -1, "Failed to malloc for connect");
......
...@@ -66,6 +66,7 @@ typedef enum { ...@@ -66,6 +66,7 @@ typedef enum {
#define PARAM_LOGI(fmt, ...) STARTUP_LOGI(LABEL, fmt, ##__VA_ARGS__) #define PARAM_LOGI(fmt, ...) STARTUP_LOGI(LABEL, fmt, ##__VA_ARGS__)
#define PARAM_LOGE(fmt, ...) STARTUP_LOGE(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, ...) \ #define PARAM_CHECK(retCode, exper, ...) \
if (!(retCode)) { \ if (!(retCode)) { \
......
...@@ -82,7 +82,7 @@ int InitWorkSpace_(WorkSpace *workSpace, int mode, int prot, u_int32_t spaceSize ...@@ -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); return PARAM_CODE_INVALID_PARAM, "Invalid param %s", workSpace->fileName);
PARAM_CHECK(workSpace->compareTrieNode != NULL, PARAM_CHECK(workSpace->compareTrieNode != NULL,
return PARAM_CODE_INVALID_PARAM, "Invalid param %s", workSpace->fileName); return PARAM_CODE_INVALID_PARAM, "Invalid param %s", workSpace->fileName);
PARAM_LOGI("InitWorkSpace %s ", workSpace->fileName); PARAM_LOGD("InitWorkSpace %s ", workSpace->fileName);
CheckAndCreateDir(workSpace->fileName); CheckAndCreateDir(workSpace->fileName);
int fd = open(workSpace->fileName, mode, 00777); //0444); int fd = open(workSpace->fileName, mode, 00777); //0444);
...@@ -111,7 +111,7 @@ int InitWorkSpace_(WorkSpace *workSpace, int mode, int prot, u_int32_t spaceSize ...@@ -111,7 +111,7 @@ int InitWorkSpace_(WorkSpace *workSpace, int mode, int prot, u_int32_t spaceSize
workSpace->area = (WorkArea*)areaAddr; workSpace->area = (WorkArea*)areaAddr;
workSpace->rootNode = GetTrieNode(workSpace, &workSpace->area->firstNode); workSpace->rootNode = GetTrieNode(workSpace, &workSpace->area->firstNode);
} }
PARAM_LOGI("InitWorkSpace success, readOnly %d currOffset %u firstNode %u dataSize %u", PARAM_LOGD("InitWorkSpace success, readOnly %d currOffset %u firstNode %u dataSize %u",
readOnly, workSpace->area->currOffset, workSpace->area->firstNode, workSpace->area->dataSize); readOnly, workSpace->area->currOffset, workSpace->area->firstNode, workSpace->area->dataSize);
return 0; return 0;
} }
......
...@@ -110,7 +110,7 @@ static int ProcessParamSet(RequestMsg *msg) ...@@ -110,7 +110,7 @@ static int ProcessParamSet(RequestMsg *msg)
int ret = GetSubStringInfo(msg->content, msg->contentSize, '=', info, sizeof(info)/sizeof(info[0])); 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_CHECK(ret >= 2, return ret, "Failed to get name from content %s", msg->content);
PARAM_LOGI("ProcessParamSet name %s value: %s", info[0].value, info[1].value); PARAM_LOGD("ProcessParamSet name %s value: %s", info[0].value, info[1].value);
ret = WriteParamWithCheck(&g_paramWorkSpace, &msg->securitylabel, 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); 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); 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* ...@@ -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) static void OnWriteResponse(uv_write_t *req, int status)
{ {
// 发送成功,释放请求内存 // 发送成功,释放请求内存
PARAM_LOGI("OnWriteResponse status %d", status); PARAM_LOGD("OnWriteResponse status %d", status);
ResponseNode *node = (ResponseNode*)req; ResponseNode *node = (ResponseNode*)req;
free(node); free(node);
} }
......
...@@ -228,7 +228,7 @@ int ParseTrigger(TriggerWorkSpace *workSpace, cJSON *triggerItem) ...@@ -228,7 +228,7 @@ int ParseTrigger(TriggerWorkSpace *workSpace, cJSON *triggerItem)
PARAM_LOGE("Warning parseTrigger %s %s", name, condition); PARAM_LOGE("Warning parseTrigger %s %s", name, condition);
} }
} }
PARAM_LOGI("ParseTrigger %s %u", name, offset); PARAM_LOGD("ParseTrigger %s %u", name, offset);
// 添加命令行 // 添加命令行
cJSON* cmdItems = cJSON_GetObjectItem(triggerItem, CMDS_ARR_NAME_IN_JSON); cJSON* cmdItems = cJSON_GetObjectItem(triggerItem, CMDS_ARR_NAME_IN_JSON);
...@@ -332,7 +332,7 @@ static int CheckTrigger_(TriggerWorkSpace *workSpace, ...@@ -332,7 +332,7 @@ static int CheckTrigger_(TriggerWorkSpace *workSpace,
static TRIGGER_MATCH triggerCheckMatch[TRIGGER_MAX] = { static TRIGGER_MATCH triggerCheckMatch[TRIGGER_MAX] = {
CheckBootTriggerMatch, CheckParamTriggerMatch, CheckOtherTriggerMatch CheckBootTriggerMatch, CheckParamTriggerMatch, CheckOtherTriggerMatch
}; };
PARAM_LOGI("CheckTrigger_ content %s ", content); PARAM_LOGD("CheckTrigger_ content %s ", content);
PARAM_CHECK(calculator != NULL, return -1, "Failed to check calculator"); 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(CHECK_INDEX_VALID(workSpace, type), return -1, "Invalid type %d", type);
PARAM_CHECK((u_int32_t)type < sizeof(triggerCheckMatch) / sizeof(triggerCheckMatch[0]), PARAM_CHECK((u_int32_t)type < sizeof(triggerCheckMatch) / sizeof(triggerCheckMatch[0]),
......
...@@ -30,7 +30,7 @@ static TriggerWorkSpace g_triggerWorkSpace = {}; ...@@ -30,7 +30,7 @@ static TriggerWorkSpace g_triggerWorkSpace = {};
static int DoCmdExecute(TriggerNode *trigger, const char *cmdName, const char *command) static int DoCmdExecute(TriggerNode *trigger, const char *cmdName, const char *command)
{ {
PARAM_CHECK(trigger != NULL && cmdName != NULL && command != NULL, return -1, "Invalid param"); PARAM_CHECK(trigger != NULL && cmdName != NULL && command != NULL, return -1, "Invalid param");
PARAM_LOGI("DoCmdExecute trigger %s cmd %s %s", trigger->name, cmdName, command); PARAM_LOGD("DoCmdExecute trigger %s cmd %s %s", trigger->name, cmdName, command);
if (strncmp(cmdName, TRIGGER_CMD, strlen(TRIGGER_CMD)) == 0) { if (strncmp(cmdName, TRIGGER_CMD, strlen(TRIGGER_CMD)) == 0) {
DoTriggerExec(command); DoTriggerExec(command);
return 0; return 0;
...@@ -155,7 +155,7 @@ void PostParamTrigger(const char *name, const char *value) ...@@ -155,7 +155,7 @@ void PostParamTrigger(const char *name, const char *value)
void PostTrigger(EventType type, const char *content, u_int32_t contentLen) void PostTrigger(EventType type, const char *content, u_int32_t contentLen)
{ {
PARAM_LOGI("PostTrigger %d %s", type, content); PARAM_LOGD("PostTrigger %d %s", type, content);
PARAM_CHECK(content != NULL && contentLen > 0, return, "Invalid param"); PARAM_CHECK(content != NULL && contentLen > 0, return, "Invalid param");
TriggerDataEvent *event = (TriggerDataEvent *)malloc(sizeof(TriggerDataEvent) + contentLen + 1); TriggerDataEvent *event = (TriggerDataEvent *)malloc(sizeof(TriggerDataEvent) + contentLen + 1);
PARAM_CHECK(event != NULL, return, "Failed to alloc memory"); PARAM_CHECK(event != NULL, return, "Failed to alloc memory");
...@@ -165,7 +165,7 @@ void PostTrigger(EventType type, const char *content, u_int32_t contentLen) ...@@ -165,7 +165,7 @@ void PostTrigger(EventType type, const char *content, u_int32_t contentLen)
memcpy_s(event->content, contentLen, content, contentLen); memcpy_s(event->content, contentLen, content, contentLen);
event->content[contentLen] = '\0'; event->content[contentLen] = '\0';
SendTriggerEvent(event); SendTriggerEvent(event);
PARAM_LOGI("PostTrigger %d success", type); PARAM_LOGD("PostTrigger %d success", type);
} }
int ParseTriggerConfig(cJSON *fileRoot) int ParseTriggerConfig(cJSON *fileRoot)
......
...@@ -124,6 +124,7 @@ void InitReadCfg() ...@@ -124,6 +124,7 @@ void InitReadCfg()
LoadDefaultParams("/system/etc/prop.default"); LoadDefaultParams("/system/etc/prop.default");
LoadDefaultParams("/system/build.prop"); LoadDefaultParams("/system/build.prop");
LoadDefaultParams("/system/buildz.prop"); LoadDefaultParams("/system/buildz.prop");
LoadDefaultParams("/product/build.prop");
#endif #endif
ParseInitCfg(INIT_CONFIGURATION_FILE); ParseInitCfg(INIT_CONFIGURATION_FILE);
ParseOtherCfgs(); ParseOtherCfgs();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册