Set country_code from iw reg if undefined

This commit is contained in:
billz 2020-07-10 18:28:28 +01:00
parent 695cdd2d35
commit 3d901ae5f9

View file

@ -27,6 +27,7 @@ function DisplayHostAPDConfig()
$arrEncType = array('TKIP' => 'TKIP', 'CCMP' => 'CCMP', 'TKIP CCMP' => 'TKIP+CCMP');
$managedModeEnabled = false;
exec("ip -o link show | awk -F': ' '{print $2}'", $interfaces);
exec("iw reg get | awk '/country / { sub(/:/,\"\",$2); print $2 }'", $country_code);
if (!RASPI_MONITOR_ENABLED) {
if (isset($_POST['SaveHostAPDSettings'])) {
@ -77,6 +78,11 @@ function DisplayHostAPDConfig()
}
};
// assign country_code from iw reg if not set in config
if (!isset($arrConfig['country_code']) && isset($country_code[0])) {
$arrConfig['country_code'] = $country_code[0];
}
echo renderTemplate(
"hostapd", compact(
"status",