Need help for https://github.com/OnionIoT/gpio-test
-
In trying to get back to adding C++ code for GPIO interrupt handling, I have been playing with the code in https://github.com/OnionIoT/gpio-test
While I can successfully build the code, when I try to run it, I get an error when it attempts to access the file /sys/kernel/debug/gpio-irq The error I am getting is:- open: No such file or directory
This comes from this bit of code in the file gpio-test.cpp
- fd=open("/sys/kernel/debug/gpio-irq", O_WRONLY);
if(fd < 0)
{
perror("open");
return false;
}
My initial thought was that I do not have access permission to /sys/kernel/debug which shows as having attributes drwx------ and though I can (apparently) change the attributes for this it doesn't make any difference.
Does anyone have any thoughts or advice?
-
@Kit-Bishop Did you compile and install
gpio-irq
package as well?
-
@Boken-Lin I have had a look at gpio-irq and didn't realise that it was required for gpio-test
I have tried compiling the source code for gpio-irq but I am currently only set up for cross compiling with the toolchain and/or sdk as has been discussed elsewhere. Attempting to build it with these reveals .h files that are not part of the toolchain and/or sdk. As far as I can see gpio-irq is a kernel module and assume it would need building using the OpenWRT package build environment.Unless gpio-irq is available via opkg (I can't see it) I will attempt to build it using the package build environment.
-
@Kit-Bishop Kernel modules can be built with the SDK as well. You simply need to install the
ipk
package that's created by the SDK and reboot the Omega to use the kernel module.
-
@Boken-Lin Thanks. I do actually now have a full OpenWRT environment and seem to have successfully built gpio-irq - at least there is an gpio-irq.ko file.
I am trying to install this on my Omega (using insmod and/or modprobe) but there is obviously either something I don't understand or something I have done wrong because doing so gives an error.
Still working on it - will be coming back to it later - have other things I need to do for now.
-
@Kit-Bishop Is it still giving the same error as before?
-
@Boken-Lin Still having problems. I must have done something wrong or am missing something.
What I have done and what I get is:- Believe I have succesfully build gpio-irq under the OpenWRT build system
- Copied resultant gpio-irq.ko file to /lib/modules/3.18.23
- Created file gpio-irq in /etc/modules.d containing the one line:
gpio-irq - Attempted to install the module using different methods with the following results:
root@Omega-0A97:~# insmod gpio-irq.ko
failed to insert gpio-irq.ko
root@Omega-0A97:~# insmod gpio-irq
failed to insert /lib/modules/3.18.23/gpio-irq.ko
root@Omega-0A97:~# modprobe gpio-irq
1 module could not be probed
- gpio-irq
root@Omega-0A97:~# modprobe gpio-irq.ko
1 module could not be probed
- gpio-irq
root@Omega-0A97:~#
Clearly not installed since trying to run gpio-test still gives the same result.
Do you have any further thoughts.?
-
@Kit-Bishop Hmmm, that's rather strange. Can you try compiling the package directly into a firmware and flashing the Omega with the firmware? This has worked for me in the past.
-
@Boken-Lin Ok will give it a try - though may be a while before I get it done.
Will get back to you if I need help.
Thanks for your responsiveness
-
@Kit-Bishop No problem