kernel-module-nxp-wlan: add watch-regdomain service
Add service to automatically detect changes in the global regulatory domain and force a PHY regulatory domain change. This allows detecting regulatory domain changes based on beacon information when 802.11d is enabled and instructing the wireless driver to download the rgpower firmware file corresponding to the selected country. If the selected country is not one of the supported ones, Worldwide rgpower_WW.bin file will be downloaded by default. Run the check service every 5 seconds through a systemd timer. https://onedigi.atlassian.net/browse/DEL-8974 Signed-off-by: Gonzalo Ruiz <Gonzalo.Ruiz@digi.com>
This commit is contained in:
parent
5001419caf
commit
b55f64207a
|
|
@ -0,0 +1,7 @@
|
|||
[Unit]
|
||||
Description=Monitor for global regulatory domain changes
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/sbin/watch_regdomain.sh
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
[Unit]
|
||||
Description=Check regdomain every 5 seconds
|
||||
|
||||
[Timer]
|
||||
OnBootSec=5sec
|
||||
OnUnitInactiveSec=5sec
|
||||
AccuracySec=1s
|
||||
Unit=watch-regdomain.service
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
REGDOMAIN_FILE="/var/run/regdomain"
|
||||
|
||||
previous=$(cat "${REGDOMAIN_FILE}" 2>/dev/null)
|
||||
|
||||
# Extract the 'global' regulatory domain
|
||||
current=$(iw reg get | grep -m1 '^country' | cut -d' ' -f2 | tr -d ':')
|
||||
|
||||
if [ -n "${current}" ] && [ "${current}" != "${previous}" ]; then
|
||||
echo "Global regulatory domain changed to '${current}'"
|
||||
echo "${current}" > "${REGDOMAIN_FILE}"
|
||||
iw reg set ${current}
|
||||
fi
|
||||
|
|
@ -5,6 +5,9 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:"
|
|||
SRC_URI:append = " \
|
||||
file://81-iw612-wifi.rules \
|
||||
file://load_iw612.sh \
|
||||
file://watch_regdomain.sh \
|
||||
file://watch-regdomain.service \
|
||||
file://watch-regdomain.timer \
|
||||
"
|
||||
|
||||
do_install:append () {
|
||||
|
|
@ -12,11 +15,23 @@ do_install:append () {
|
|||
install -m 0644 ${WORKDIR}/81-iw612-wifi.rules ${D}${sysconfdir}/udev/rules.d/
|
||||
install -d ${D}${sysconfdir}/udev/scripts
|
||||
install -m 0777 ${WORKDIR}/load_iw612.sh ${D}${sysconfdir}/udev/scripts/
|
||||
|
||||
if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
|
||||
install -d ${D}${systemd_system_unitdir}
|
||||
install -m 0644 ${WORKDIR}/watch-regdomain.service ${D}${systemd_system_unitdir}/watch-regdomain.service
|
||||
install -m 0644 ${WORKDIR}/watch-regdomain.timer ${D}${systemd_system_unitdir}/watch-regdomain.timer
|
||||
fi
|
||||
|
||||
install -d ${D}${sbindir}
|
||||
install -m 0755 ${WORKDIR}/watch_regdomain.sh ${D}${sbindir}/
|
||||
}
|
||||
|
||||
FILES:${PN}:append = " \
|
||||
${sysconfdir}/udev/rules.d \
|
||||
${sysconfdir}/udev/scripts \
|
||||
${sbindir}/watch_regdomain.sh \
|
||||
${systemd_system_unitdir}/watch-regdomain.service \
|
||||
${systemd_system_unitdir}/watch-regdomain.timer \
|
||||
"
|
||||
|
||||
RDEPENDS:${PN}:append = " firmware-murata-nxp"
|
||||
|
|
|
|||
Loading…
Reference in New Issue