blob: beb094d2b5cccd13236154bf913cac8bc7bec6a7 [file] [log] [blame]
# 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 US RU"
script
for regdomain in $constrained_regdomains ; do
if dump_vpd_log --stdout | grep -qi "^\"region\"=\"${regdomain}\"$" ; then
# Wait for a wireless LAN interface to appear, since this regdomain
# needs to be applied afterwards.
wait_tries=0
while [ ${wait_tries} -le 10 ] ; do
if iw dev | grep -q Interface; then
break
fi
sleep 1
wait_tries=$((wait_tries + 1))
done
iw reg set ${regdomain}
break
fi
done
end script