On 08/12/14 13:41, Nithin Chakravarthy wrote:

> I have requirement to A20 gpio as interrupt from user space. 
> I have custom board to which switches sw1 sw2 sw3 are connected
> to gpio PD0,PD1,PD2 respectively. so, if button is pressed i should perforn 
> some action. how can i do this from my application side.
> so please help me!!! 

See:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/gpio/sysfs.txt

for the full details.


/sys/class/gpio/gpioN/

[...]

"value" ... reads as either 0 (low) or 1 (high). If the GPIO
        is configured as an output, this value may be written;
        any nonzero value is treated as high.

        If the pin can be configured as interrupt-generating interrupt
        and if it has been configured to generate interrupts (see the
        description of "edge"), you can poll(2) on that file and
        poll(2) will return whenever the interrupt was triggered. If
        you use poll(2), set the events POLLPRI and POLLERR. If you
        use select(2), set the file descriptor in exceptfds. After
        poll(2) returns, either lseek(2) to the beginning of the sysfs
        file and read the new value or close the file and re-open it
        to read the value.

"edge" ... reads as either "none", "rising", "falling", or
        "both". Write these strings to select the signal edge(s)
        that will make poll(2) on the "value" file return.

        This file exists only if the pin can be configured as an
        interrupt generating input pin.


This is a generic interface, you can use it from any language that gives 
you access to a poll or select call.


-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to