概述
/******************************************************************************/
/*---用户空间:ssr_setup: 设置子系统的restart_level: system or related---
* 这个文件感觉没做什么,且写入的是related, 而实际是RELATED,但log确输出了,
* 这段代码肯定运行到了*/
/******************************************************************************/
device/qcom/common/rootdir/etc/init.qcom.rc
service ssr_setup /system/bin/ssr_setup
oneshot
disabled
service ss_ramdump /system/bin/subsystem_ramdump 2
class late_start
group system
on property:persist.sys.ssr.restart_level=*
start ssr_setup
on property:persist.sys.ssr.enable_ramdumps=1
write /sys/module/subsystem_restart/parameters/enable_ramdumps 1
mkdir /data/ramdump 770 system system /*手机没有这个文件夹啊?*/
vendor/qcom/proprietary/ss-restart/ssr_setup/ssr_setup.c
int main(int argc, char *argv[])
{
int i = 0;
char *tok_ptr;
int use_prop = 0;
char *subsys_name;
int num_subsys = 0;
char subsys_buf[PROPERTY_VALUE_MAX] = {0};
if (argc < 2) {
ALOGI("Using persist.sys.ssr.restart_level for ssr_setup");
use_prop = 1;
}
property_get(SSR_SETUP_PROP, subsys_buf, "N/A");
if (!strncmp(subsys_buf, "N/A", sizeof(subsys_buf))) {
ALOGI("ssr prop empty. Disabling SSR for all modules");
}
setup_ssr()
}
#define SSR_BUS_ROOT "/sys/bus/msm_subsys/devices"
#define SSR_SETUP_PROP "persist.sys.ssr.restart_level"
int setup_ssr(int num_subsys)
{
//Go through ssr_bus_root dir enabling everything in the enable list
//and disabling everything else.
dir_ssr_bus = opendir(SSR_BUS_ROOT);
if (!dir_ssr_bus) {
ALOGE("Failed to open SSR root dir: %s", strerror(errno));
goto error;
}
/*轮询各个路径:依次返回*/
while((de = readdir(dir_ssr_bus))) {
if (de->d_name[0] == '.')
continue;
snprintf(ssr_toggle_path,
sizeof(ssr_toggle_path),
"%s/%s/restart_level",
SSR_BUS_ROOT,
de->d_name);
fd = open(ssr_toggle_path, O_WRONLY);
if (enable_ssr) {
ALOGI("Enabling SSR for %s", de->d_name);
if (write(fd, "related",7) < 0) {
ALOGE("Failed to write to ssr node: %s",
strerror(errno));
goto error;
}
} else {
ALOGI("Disabling ssr for %s", de->d_name);
if (write(fd, "system",6) < 0) {
ALOGE("Failed to write to ssr node: %s",
strerror(errno));
goto error;
}
}
}
}
最后
以上就是虚心小土豆为你收集整理的qcom platform 子系统(6)的全部内容,希望文章能够帮你解决qcom platform 子系统(6)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复