mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-22 07:30:23 +00:00
Improve handling of wpa_cli output
This commit is contained in:
parent
d76984517c
commit
43c9997f07
2 changed files with 7 additions and 11 deletions
|
@ -107,8 +107,7 @@ function DisplayDashboard(&$extraFooterScripts)
|
|||
$wlanHasLink = false;
|
||||
$matchesSSID[1] = 'None';
|
||||
}
|
||||
|
||||
$connectedSSID = $matchesSSID[1];
|
||||
$connectedSSID = str_replace('\x20', '', $matchesSSID[1]);
|
||||
|
||||
preg_match('/freq: (\d+)/i', $stdoutIwWRepSpaces, $matchesFrequency) || $matchesFrequency[1] = '';
|
||||
$frequency = $matchesFrequency[1].' MHz';
|
||||
|
|
|
@ -60,13 +60,10 @@ function nearbyWifiStations(&$networks, $cached = true)
|
|||
exec('sudo wpa_cli -i ' .$_SESSION['wifi_client_interface']. ' scan');
|
||||
sleep(3);
|
||||
|
||||
exec('sudo wpa_cli -i ' .$_SESSION['wifi_client_interface']. ' scan_results', $stdout);
|
||||
array_shift($stdout);
|
||||
|
||||
return implode("\n", $stdout);
|
||||
$stdout = shell_exec('sudo wpa_cli -i ' .$_SESSION['wifi_client_interface']. ' scan_results');
|
||||
return preg_split("/\n/", $stdout);
|
||||
}
|
||||
);
|
||||
|
||||
// get the name of the AP. Should be excluded from nearby networks
|
||||
exec('cat '.RASPI_HOSTAPD_CONFIG.' | sed -rn "s/ssid=(.*)\s*$/\1/p" ', $ap_ssid);
|
||||
$ap_ssid = $ap_ssid[0];
|
||||
|
@ -77,10 +74,10 @@ function nearbyWifiStations(&$networks, $cached = true)
|
|||
if ( isset($lastnet['index']) ) $index = $lastnet['index'] + 1;
|
||||
}
|
||||
|
||||
foreach (explode("\n", $scan_results) as $network) {
|
||||
array_shift($scan_results);
|
||||
foreach ($scan_results as $network) {
|
||||
$arrNetwork = preg_split("/[\t]+/", $network); // split result into array
|
||||
|
||||
$ssid = trim($arrNetwork[4]);
|
||||
$ssid = $arrNetwork[4];
|
||||
|
||||
// exclude raspap ssid
|
||||
if (empty($ssid) || $ssid == $ap_ssid) {
|
||||
|
|
Loading…
Reference in a new issue