|
最近在写电机的驱动,,但是用户态的数据怎么也进不了内核态.大家看看
int motor_drv_write (struct inode *inode, struct file *filp, const char *buf,int count){
int value;
(int *)buf;
copy_from_user(&value,buf,count);
printk("The command is %d\n",value);
}
应用程序为:
main()
{
int fd;
int a=4;
int retval;
fd=open("/dev/motor_drv",O_RDWR);
retval=write(fd,&a,1 );
delay(1000000);
}
我的想法是如果传值成功的话应该打印出:4 的. |
|