QProcess - 无法通过密码或使用iwconfig执行任何操作

时间:2018-04-23 11:00:12

标签: linux qt qprocess iwconfig

我正在尝试禁用wifi模块的低功耗模式。我无法访问物理设备。我只能使用我的应用程序(远程更新)来执行命令:echo pass1234 | sudo / sbin / iwconfig wlan0 power off

我使用Armbian,命令不能与QProcess一起使用(wifi模块没有变化):

QProcess sh;
qDebug()<<cmd;
sh.start("bash");
sh.write(cmd.toLatin1());
sh.closeWriteChannel();
sh.waitForFinished();
QByteArray output = sh.readAll();
QString mystr(output);
qDebug()<<"OUT::"<<mystr;
sh.close();

问题是用户(没有root)密码。系统需要此密码,我无法将其传递给流程。我尝试了所有知道的方法,但我失败了。有什么提示吗?

0 个答案:

没有答案
相关问题