【问题标题】:get graphic card info in linux ( /proc file system )在 linux 中获取显卡信息(/proc 文件系统)
【发布时间】: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


    【解决方案1】:

    我不完全确定我是否理解您的问题实际上是关于什么的。但是,如果您问在哪里可以阅读有关您的显卡的信息,这里是我的 0.01 欧元。

    /sys/bus/pci/devices 下提供 PCI 设备信息。

    使用lspci 找出您的显卡的设备号。例如:lspci |grep -i graphics|awk '{ print $1 }'

    然后在/sys/bus/pci/devices 中查看相应的子目录。

    【讨论】:

      猜你喜欢
      • 2017-11-07
      • 2014-06-12
      • 2011-12-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-07
      • 2021-10-13
      • 1970-01-01
      相关资源
      最近更新 更多