From: Michael Tremer Date: Tue, 26 Aug 2014 17:51:24 +0000 (+0200) Subject: Configure wireless reg domain when wireless hardware is plugged in X-Git-Tag: 007~107 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06a6f01ee9b8702505540ac8bfd97f96c0cf73b7;p=network.git Configure wireless reg domain when wireless hardware is plugged in --- diff --git a/src/functions/functions.wireless b/src/functions/functions.wireless index f32733ac..f33419e3 100644 --- a/src/functions/functions.wireless +++ b/src/functions/functions.wireless @@ -23,8 +23,6 @@ WIRELESS_REGULATORY_DOMAIN="00" NETWORK_CONFIG_FILE_PARAMS="${NETWORK_CONFIG_FILE_PARAMS} WIRELESS_REGULATORY_DOMAIN" -init_register wireless_init_reg_domain - function wireless_create() { local device=${1} assert isset device @@ -110,15 +108,34 @@ function wireless_get_reg_domain() { function wireless_init_reg_domain() { local country_code="$(wireless_get_reg_domain)" - wireless_set_reg_domain "${country_code}" + wireless_set_reg_domain "${country_code}" --no-reset } function wireless_set_reg_domain() { - local country_code="${1}" + local country_code + local reset="true" + + while [ $# -gt 0 ]; do + case "${1}" in + --no-reset) + reset="false" + ;; + -*) + log ERROR "Ignoring invalid option: ${1}" + ;; + *) + country_code="${1}" + ;; + esac + shift + done + assert isset country_code # Before the wireless reg domain is set, it helps to reset to 00 first. - iw reg set 00 &>/dev/null + if enabled reset; then + iw reg set 00 &>/dev/null + fi log INFO "Setting wireless regulatory domain country to '${country_code}'" iw reg set "${country_code}" diff --git a/src/udev/network-hotplug b/src/udev/network-hotplug index 3d4809a5..1b79bd0a 100644 --- a/src/udev/network-hotplug +++ b/src/udev/network-hotplug @@ -60,6 +60,9 @@ case "${ACTION}" in # Handle batman-adv and wireless devices. batman-adv|batman-adv-port|wireless) + # Load regulatory domain for wireless devices + wireless_init_reg_domain + # Save the phy of this device for later. phy=$(phy_get ${INTERFACE}) assert isset phy