【发布时间】:2013-12-10 14:06:02
【问题描述】:
我可以创建 proc 文件。我想使用 proc 读取功能了解显卡信息。我该怎么做? 我并不是要在终端中学习该信息(通过编写 lspci vs)。 你知道/proc目录下存储显卡信息的文件的路径吗?
#include <linux/init.h>
#include <linux/module.h>
#include <linux/proc_fs.h>
// read proc function
int read_proc(char *buf, char **start, off_t offset, int count, int *eof, void *data) {
/* file to be read? */
return 1;
}
// Module loading..
static int start(void){
create_proc_read_entry("myproc", 0, NULL, read_proc, NULL);
return 0;
}
static void fin(void) {
remove_proc_entry("myproc", NULL);
}
module_init(start);
module_exit(fin);
【问题讨论】:
标签: linux ubuntu systems-programming