According to this, I'm using the system() (QProcess) function from inside my program to call the gpio program.
It works. But I've noticed I need to run my app two times, in fact it only works at the second time. It seems the call to gpio must be done in another process, as pointed here.
Should this problem be approached with QProcess::setupChildProcess()?
I extended QProcess overwriting setupChildProcess and then just instanciated SandboxProcess in the constructor of my app. Unfortunately, this didn't worked.
class SandboxProcess : public QProcess
{
protected:
void setupChildProcess();
};
void SandboxProcess::setupChildProcess()
{
QString program = "/usr/local/bin/gpio";
QStringList arguments;
arguments << "export" << QString::number(4) << "out";
start(program, arguments);
}