Merge pull request #608 from zbchristian/zbchristian-wlan-switch

Check for second wifi interface as wifi client
This commit is contained in:
Bill Zimmerman 2020-06-09 12:36:29 +02:00 committed by GitHub
commit 7d06bece80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -138,7 +138,10 @@ function getWifiInterface()
if (empty($_SESSION['client_iface'])) {
$arrHostapdConf = parse_ini_file(RASPI_CONFIG.'/hostapd.ini');
if (isset($arrHostapdConf['WifiInterface'])) {
$_SESSION['client_iface'] = $arrHostapdConf['WifiInterface'];
$iface = $arrHostapdConf['WifiInterface'];
// check for 2nd wifi interface
exec("iw dev | awk '$1==\"Interface\" && $2!=\"$iface\" {print $2}'",$iface2);
$_SESSION['client_iface'] = empty($iface2) ? $iface : trim($iface2[0]);
} else { // fallback to default
$_SESSION['client_iface'] = RASPI_WIFI_CLIENT_INTERFACE;
}