From b90f441fded3910c9dc58336ef65e14a059a6bfa Mon Sep 17 00:00:00 2001 From: arcan1s Date: Tue, 10 Mar 2015 07:53:15 +0300 Subject: [PATCH] roll back interfaces to wpa_cli improvement of wpa_supplicant control --- sources/netctlgui/src/wpasupinteract.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/sources/netctlgui/src/wpasupinteract.cpp b/sources/netctlgui/src/wpasupinteract.cpp index de9e245..fc204dd 100644 --- a/sources/netctlgui/src/wpasupinteract.cpp +++ b/sources/netctlgui/src/wpasupinteract.cpp @@ -270,12 +270,8 @@ netctlWifiInfo WpaSup::current() _pidFile.replace(QString("$i"), interfaces[0]); if (debug) qDebug() << PDEBUG << ":" << "PID file" << _pidFile << QFile(_pidFile).exists(); - bool terminateOnExit = (!QFile(_pidFile).exists()); netctlWifiInfo current; - if (!startWpaSupplicant()) { - if (terminateOnExit) stopWpaSupplicant(); - return current; - } + if (!QFile(_pidFile).exists()) return current; QStringList rawList = getWpaCliOutput(QString("status")).split(QChar('\n'), QString::SkipEmptyParts); for (int i=0; igetWirelessInterfaceList(); + if (interfaces.isEmpty()) { + if (debug) qDebug() << PDEBUG << ":" << "Could not find interfaces"; + return false; + } - QString cmd = QString("%1 -p %2 %3").arg(wpaCliPath).arg(ctrlDir).arg(commandLine); + QString cmd = QString("%1 -i %2 -p %3 %4").arg(wpaCliPath).arg(interfaces[0]).arg(ctrlDir).arg(commandLine); if (debug) qDebug() << PDEBUG << ":" << "Run cmd" << cmd; TaskResult process = runTask(cmd); if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode; @@ -554,8 +554,13 @@ bool WpaSup::wpaCliCall(const QString commandLine) if (debug) qDebug() << PDEBUG << ":" << "Could not find wpa_cli"; return false; } + QStringList interfaces = netctlCommand->getWirelessInterfaceList(); + if (interfaces.isEmpty()) { + if (debug) qDebug() << PDEBUG << ":" << "Could not find interfaces"; + return false; + } - QString cmd = QString("%1 -p %2 %3").arg(wpaCliPath).arg(ctrlDir).arg(commandLine); + QString cmd = QString("%1 -i %2 -p %3 %4").arg(wpaCliPath).arg(interfaces[0]).arg(ctrlDir).arg(commandLine); if (debug) qDebug() << PDEBUG << ":" << "Run cmd" << cmd; TaskResult process = runTask(cmd); waitForProcess(1);