| # Copyright (c) 2013 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| description "Set regulatory domain for restrictive domains" |
| author "chromium-os-dev@chromium.org" |
| |
| # We also need to run after cfg80211 is loaded by shill.conf so the "iw" |
| # command will work. |
| start on started shill |
| |
| # The list of regulatory domains which we must apply in order to constrain |
| # the system to a more restrictive behavior than our world regulatory domain. |
| # The system can only be set to one regulatory domain at a time. As well, |
| # any given system should have only one "region" value. However, in order |
| # to hedge against any strange cases, this value should be in decreasing |
| # order of constraints, so the system will attain the most constrained |
| # domain. |
| env constrained_regdomains="ID AR" |
| |
| script |
| for regdomain in $constrained_regdomains ; do |
| if dump_vpd_log --stdout | grep -qi "^\"region\"=\"${regdomain}\"$" ; then |
| # We do this twice so we cause the cfg80211 state machine to accept |
| # the change. |
| iw reg set ${regdomain} |
| iw reg set ${regdomain} |
| break |
| fi |
| done |
| end script |