一、驱动中注册的函数
1.platform_driver_register
-----/sys/platform/driver/
2.Cdev_init
----/dev/
二、Log输出
1.Printk
2.Printk在kernel中提供了打印的等级,方便输出
3.很多人在调试的时候如果通过USB想看看kernel的log的话,可以修改logcat.cpp文件
三、Proc
proc--|
|-----read_proc
|-----write_proc
例子:
struct proc_dir_entry *prEntry;
prEntry = create_proc_entry("driver/proc_func", 0, NULL);
if (prEntry) {
prEntry->read_proc = read_proc_func;
prEntry->write_proc = write_proc_func;
}
else {
printk("add /proc/driver/camsensor entry fail \n");
}
四、Device attribution
attr-|
|-----show
|-----store
static struct device_attribute test1_attr = {
.attr = {
.name = "test1",
.mode = 0644,
.owner = THIS_MODULE
},
.show = test1_show_func,
.store = test1_store_func,
};
五、APP
App
Android APK
六、Oops / panic
1. Tracking System.map find crash point is tmd2771_init
2. Crash program counter is c01adb70 PC is at memcpy+0x270/0x330
3. Function entry is (tmd2771_init) c00205d8
4. Disassembly source code (-S ) , check panic at which instruction
七、驱动调试总结
1、判断设备是否存在;
2、是否可以正常的通信;
3、利用printk来将需要的信息打印出来;
4、能做一些小应用来调试需要测试的功能;
5、关于oops的问题可以按照步骤来看看是代码中哪里出问题;
6、有对比机器,确认是共性还是特例;