[Solved] QProcess and backlight linux command
-
Hello Guys!
I try to modify the brightness of my display in Qt, running the command:echo 6 > /sys/class/backlight/mxs-bl/brightness
and using QProcess like this:
@QProcess *sh = new QProcess();
sh->start( "echo 6 > /sys/class/backlight/mxs-bl/brightness");
sh->waitForFinished();
QByteArray output = sh->readAll();
ui->label->setText(output);
sh->close();@But it print only "6 > /sys/class/backlight/mxs-bl/brightness" instead of do the command like in the shell, and don't change the value of the brightness.
Any idea? Thank you so much. -
try this:
@
QProcess *sh = new QProcess();
sh->write("6"); //write to stdin of the process
//sh->closeWriteChannel(); //not sure if this line is needed
sh->start( "/sys/class/backlight/mxs-bl/brightness");
@ -
ok... one more try:
@
QProcess *sh = new QProcess();
sh->start( "/sys/class/backlight/mxs-bl/brightness");
sh->write("6"); //write to stdin of the process
sh->closeWriteChannel();
@ -
well ... i thought "/sys/class/backlight/mxs-bl/brightness" is a application rather than a file.
I thought you know what your were doing when you using QProcess in the first place ;)