
Originally Posted by
wysota
Use
QSocketNotifier on your /dev/button to be notified of changes in the button and only react when there actually is a change. There is no point in having a busy loop (and wasting cpu power and electricity) just for reading the button status.
Now i have tried both ways using processevents and Qsocketnotifier.
placing process events in a loop made the application heavy since CPU load
Qsocketnotifier works very good. now i have to check how fast the signals are caught.
here is the part for the code:
buttons_fd = ::open("/dev/buttons", 0);
connect(sockerNotifier,SIGNAL(activated(int)),this,SLOT(notify()));
buttons_fd = ::open("/dev/buttons", 0);
QSocketNotifier *sockerNotifier= new QSocketNotifier(buttons_fd,QSocketNotifier::Read,this);
connect(sockerNotifier,SIGNAL(activated(int)),this,SLOT(notify()));
To copy to clipboard, switch view to plain text mode
thank you for your help
Bookmarks