From: Josep Orga Date: Fri, 16 Apr 2021 11:30:33 +0000 (+0200) Subject: meta-somdevices: hostapd: Add hostapd script to restart wilc-sdio module after stoppi... X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=c70ee796f1efaecec820cf7c16d3e5c4a70ed23b;p=meta-somdevices.git meta-somdevices: hostapd: Add hostapd script to restart wilc-sdio module after stopping hostapd service. Signed-off-by: Josep Orga --- diff --git a/recipes-connectivity/hostapd/hostapd/hostapd.sh b/recipes-connectivity/hostapd/hostapd/hostapd.sh new file mode 100644 index 0000000..fd4b1ab --- /dev/null +++ b/recipes-connectivity/hostapd/hostapd/hostapd.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +sleep 1 +if [ ! -d /sys/class/net/wlan0 ]; then + #If wlan0 device does not exist reset wilc-sdio module + /sbin/rmmod wilc-sdio + sleep 1 + /sbin/modprobe wilc-sdio +fi \ No newline at end of file diff --git a/recipes-connectivity/hostapd/hostapd_2.8.bbappend b/recipes-connectivity/hostapd/hostapd_2.8.bbappend index 5f639ed..c59b0e1 100644 --- a/recipes-connectivity/hostapd/hostapd_2.8.bbappend +++ b/recipes-connectivity/hostapd/hostapd_2.8.bbappend @@ -1,7 +1,8 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" -SUMMARY = "Change hostapd.conf file" -DESCRIPTION = "Enable 80211n-mode and WPA2-PSK security and change SSID to hostname and password to hostname1234" +SUMMARY = "Change hostapd.conf file and add hostapd script to restore wlan0" +DESCRIPTION = "Enable 80211n-mode and WPA2-PSK security and change SSID to hostname and password to hostname1234. \ +And restore wlan0 with hostapd script restarting wilc-sdio module after stopping hostapd service." PR = "somdevices.0" MAINTAINER = "SomDevices " @@ -11,6 +12,9 @@ SYSTEMD_SERVICE_${PN} = " hostapd.service" SYSTEMD_AUTO_ENABLE_${PN} = "enable" HOSTAPD_AP = "somdevices" +SRC_URI += " file://hostapd.sh \ +" + do_install_append () { echo "#content hostapd.conf" > ${D}/etc/hostapd.conf echo "interface=wlan0" >> ${D}/etc/hostapd.conf @@ -25,4 +29,8 @@ do_install_append () { echo "hw_mode=g" >> ${D}/etc/hostapd.conf echo "ieee80211n=1" >> ${D}/etc/hostapd.conf echo "wmm_enabled=1" >> ${D}/etc/hostapd.conf + #Insert hostapd script + install -d ${D}${sysconfdir}/network/if-post-down.d/ + install -m 755 ${WORKDIR}/hostapd.sh ${D}${sysconfdir}/network/if-post-down.d/hostapd + sed -i "9i ExecStopPost=/etc/network/if-post-down.d/hostapd" ${D}${systemd_unitdir}/system/hostapd.service }