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
已解决! 转到解答。
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!
-----------------------------------------------------------------------------------------------------------------------
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.