qcom platform 子系统(3)

来源:互联网 发布:中国移动摇话费软件 编辑:程序博客网 时间:2024/05/22 09:00
/******************************************************************************/
/*怎样重启 子系统?*/
/******************************************************************************/
root@gemini:/sys/kernel/debug/msm_subsys # ls -al
-rw-r--r-- root     root            0 1970-01-01 08:00 AR6320
-rw-r--r-- root     root            0 1970-01-01 08:00 a530_zap
-rw-r--r-- root     root            0 1970-01-01 08:00 adsp
-rw-r--r-- root     root            0 1970-01-01 08:00 modem
-rw-r--r-- root     root            0 1970-01-01 08:00 slpi
-rw-r--r-- root     root            0 1970-01-01 08:00 venus
static ssize_t subsys_debugfs_read(struct file *filp, char __user *ubuf,
size_t cnt, loff_t *ppos)
{
int r;
char buf[40];
struct subsys_device *subsys = filp->private_data;


r = snprintf(buf, sizeof(buf), "%d\n", subsys->count);
return simple_read_from_buffer(ubuf, cnt, ppos, buf, r);
}


static ssize_t subsys_debugfs_write(struct file *filp,
const char __user *ubuf, size_t cnt, loff_t *ppos)
{
struct subsys_device *subsys = filp->private_data;
char buf[10];
char *cmp;


cnt = min(cnt, sizeof(buf) - 1);
if (copy_from_user(&buf, ubuf, cnt))
return -EFAULT;
buf[cnt] = '\0';
cmp = strstrip(buf);


if (!strcmp(cmp, "restart")) {
if (subsystem_restart_dev(subsys))
return -EIO;
} else if (!strcmp(cmp, "get")) {
if (subsystem_get(subsys->desc->name))
return -EIO;
} else if (!strcmp(cmp, "put")) {
subsystem_put(subsys);
} else {
return -EINVAL;
}


return cnt;

}

echo "restart" > xxxx

0 0