- 论坛徽章:
- 0
|
主要程序如下:
static struct proc_dir_entry *pAdv7180ProcDir =NULL;
/*然后在初始化模块的例程(init)中加入以下的代码*/
{
pAdv7180ProcDir =proc_mkdir("adv7180",0);
struct proc_dir_entry *pstatusprocent =NULL;
pstatusprocent = create_proc_entry( "videostatus", 0, pAdv7180ProcDir);
pstatusprocent ->read_proc = fortune_read;
pstatusprocent ->data =NULL;
pstatusprocent ->owner = THIS_MODULE;
}
/*我每次在串口命令cat /proc/adv7180/videostatus ,下面的fortune_read函数都会调用3次,
有没有办法只执行一次的呢?*/
static int fortune_read( char *page, char **start, off_t off,
int count, int *eof, void *data )
{
printk(<0>111111\n");
} |
|