Reputation: 5
I am trying to perform some GPIO operations through a lodable kernel module. for which, I am trying to access the file "/sys/class/leds/led1/brightness" using open() and write() system-calls, therefore I have included the following header files.
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
but while cross compiling the project, I got the following warning and error.
guru@guru-G40-80:~/OFC/lnx/projects/V4/source_codes/git/Device-Driver/char_dev_gsm$ make
pwd : /home/guru/OFC/lnx/projects/V4/source_codes/git/Device-Driver/char_dev_gsm
make -C /home/guru/OFC/lnx/projects/V4/source_codes/git/linux-at91/ M=/home/guru/OFC/lnx/projects/V4/source_codes/git/Device-Driver/char_dev_gsm modules
make[1]: Entering directory '/home/guru/OFC/lnx/projects/V4/source_codes/git/linux-at91'
WARNING: Symbol version dump ./Module.symvers
is missing; modules will have no dependencies and modversions.
pwd : /home/guru/OFC/lnx/projects/V4/source_codes/git/Device-Driver/char_dev_gsm
CC [M] /home/guru/OFC/lnx/projects/V4/source_codes/git/Device-Driver/char_dev_gsm/src/pwr_hndl/pwr_hndl.o
/home/guru/OFC/lnx/projects/V4/source_codes/git/Device-Driver/char_dev_gsm/src/pwr_hndl/pwr_hndl.c:5:10: fatal error: sys/stat.h: No such file or directory
#include <sys/stat.h>
^~~~~~~~~~~~
compilation terminated.
Here is a link to git-hub : https://github.com/guruprasad-92/Device-Driver.git Can you please help me with this ?
Upvotes: 0
Views: 263
Reputation: 15218
Sorry but you are doing it wrong - don't try to access the GPIO user space interface from the kernel. Instead, use the in-kernel GPIO interface.
More info on that here: https://lwn.net/Articles/532714/
Upvotes: 1