Hi All,
I'm using iMX6 sabresd board and Android 6 platform. Any one of gpio i configured as button.
When ever the user press the button, i need to run a shell command(or shell script) on board.
How can i do this .?
Regards,
Aravinth
Solved! Go to Solution.
Thanks for your response Carlos. I have used call_usermodehelper function to call shell command in kernel.
Regards,
Aravinth
Hi,
in the following link you will find the code for a .ko module which handles a GPIO interrupt and the device tree configuration required for this.
Issue with configuring GPIO as an interrupt - i.MX6Q
For the shell command you can just use a system call E.g. sytem("command");
Regards,
Carlos
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Carlos,
Thanks for your response. For system function what library i have to use in imx6 kernel.?
Regards,
Aravinth
it is stdio.h, this is a general C question, you can find a lot of information if you Google "linux shell command in c program" or "linux c system function".
Hi carlos,
I have used system function in normal c application. But in kernel code we can't add stdio.h. So i'm not able to use system function in kernel.!
Regards,
Aravinth
You can make an application that communicates with the kernel module. So the module will use copy_to_user function to tell the applications that a button was pressed and the application will execute the shell command.
Thanks for your response Carlos. I have used call_usermodehelper function to call shell command in kernel.
Regards,
Aravinth