get graphic card info in linux ( /proc file system )

3k views Asked by At

I can create proc file.what I want to learn graphic card info using proc read function.How can I do this? I do not mean to learn that info in terminal( by writing lspci vs). do you know the path of which file stores the graphic card info in /proc directory?

#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);
1

There are 1 answers

0
AudioBubble On

I am not completely sure if I understand what your question is actually about. But in case you're asking where you can read information about your graphics card(s), here are my 0.01€.

PCI device information is available under /sys/bus/pci/devices.

Use lspci to find out the device number(s) for your graphics card(s). For example: lspci |grep -i graphics|awk '{ print $1 }'.

Then see appropriate subdirectories in /sys/bus/pci/devices.