--- /dev/null
+#!/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
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 <somdevices@somdevices.com>"
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
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
}