Linux Userspace GPIO Interrupts using sysfs

元气小坏坏 提交于 2019-12-12 12:22:58

问题


I would like to use interrupts with GPIO on userspace using sysfs. I use these commands :

[root@at91]:gpio109 > echo 109 > export
[root@at91]:gpio109 > cd gpio109/
[root@at91]:gpio109 > ll
-rw-r--r--    1 root     0            4096 Jan  1 00:17 direction
drwxr-xr-x    2 root     0               0 Jan  1 00:17 power
lrwxrwxrwx    1 root     0               0 Jan  1 00:17 subsystem -> ../../gpio
-rw-r--r--    1 root     0            4096 Jan  1 00:17 uevent
-rw-r--r--    1 root     0            4096 Jan  1 00:17 value

The gpio works well but I can't use interrupts. I read everywhere i must have an edge file to poll this file. But on my system this file doesn't exist. I made a lot of tries to find a solution but remain unsuccessfull.

My target is an AT91SAM9263 on linux kernel 2.6.30.

At the boot of my board I got this message on interrupts :

AT91: 160 gpio irqs in 5 banks

which show that the function at91_gpio_irq_setup() is well executed.

Have you any idea ?


回答1:


The "edge" file only exists if that GPIO pin can be configured as a an interrupt generting pin. See: http://www.mjmwired.net/kernel/Documentation/gpio.txt#634.

Since you don't see it, it means the driver and possibly the hardware do not support using that GPIO pin for interrupt source.



来源:https://stackoverflow.com/questions/8723911/linux-userspace-gpio-interrupts-using-sysfs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!