Important: Please read the Qt Code of Conduct -

How to generate interrupt by GPIO button

  • Hi
    I am working on ARM AM335x processor and linux operating system.
    I want to make my app Interrupt based.I Want to set the Text on the Qlabel on pressing the gpio button.on pressing the button /sys/gpio/gpioN/value this value file content changes from '1" to "0" and on releasing
    again becomes 0.means by default this value file value is "0".actually I have develop my Application in polling mode i have continiously monitoring the value file content and based on that performing the task. but my requirement is interrupt can i generate interrupt from this gpio button.

    i used QFileSystemWatcher for monitoring the file and emit the signal filechanged() and connect it to a slot whhich is setting the text.but the problem it is monitor the file and emmit the signal only one time it is not monitoring file again. if i connect it again in the slot.

  • Moderators

    @Rahul-Chauhan AFAIK all the hardware data is read and written by the kernel into the sys virtual filesystem. So you have no other option that polling. If QFileSystemWatcher doesnot suits you needs go more further and try inotify and if that is not sufficient have a look at the kernel sysfs API. I'm not sure how you could do that from kernel space(may be kernel module ?) but from the user space you have no other option than polling IMO.
    Have you tried QSocketNotifier instead ?

Log in to reply