call_usermodehelpere();函数作用是代替串口使用
static ssize_t period_show(struct device *child,
struct device_attribute *attr,
char *buf)
{
const struct pwm_device *pwm = child_to_pwm_device(child);
struct pwm_state state;
pwm_get_state(pwm, &state);
//add long
+ int ret ;
+ char path[]="/system/bin/touch";
+ char *argv[]={path,"/data/touch.txt",NULL};
+ char *envp[]={NULL,NULL,NULL};
+ printk("long min call_usermodehelper module isstarting..!\n");
+ ret = call_usermodehelper(path, argv, envp,UMH_WAIT_PROC);
//end long
return sprintf(buf, "%u\n", state.period);
}
代替adb指令:touch data/touch.txt