/home/moudle/led/first_drv.c:65: error: implicit declaration of function 'class_create' //改为device_create
/home/moudle/led/first_drv.c:65: warning: assignment makes pointer from integer without a cast
/home/moudle/led/first_drv.c:67: error: implicit declaration of function 'class_device_create' //改为device_create
/home/moudle/led/first_drv.c:67: warning: assignment makes pointer from integer without a cast
/home/moudle/led/first_drv.c: In function 'first_drv_exit':
/home/moudle/led/first_drv.c:79: error: implicit declaration of function 'class_device_unregister' //改为device_unregister
/home/moudle/led/first_drv.c:80: error: implicit declaration of function 'class_destroy' --device_destroy
解决办法:
在linux-2.6.30.4/include/linux/下的device.h头文件看了说明,但是改过来还是有错,就直接删除自动加载,改为手动,后面再研究;
error: asm/arch/regs-gpio.h: No such file or directory
解决办法:
asm改为mach
[root@EmbedSky ying]# ./firstdrvtest off
can't open!
解决办法:
没有mknod,用cat /proc/device找到firstdrvtest.ko的主设备号,然后mknod /dev/xyz(这个在firstdrvtest程序里写好的了)c 111(主设备号) 0(次设备号,写0就好)
加载用户程序,程序自动循环,按键的时候没有功能,不能与驱动进行交互
解决方法:
static struct file_operations botton_fops = {
.owner = THIS_MODULE, /* 这是一个宏,推向编译模块时自动创建的__this_module变量 */
.open = botton_open,
.read =botton_read,
};
在里面的.read的时候错误写成.write