From 4bb6f26b05450777d14aa96e10783066c2503dc2 Mon Sep 17 00:00:00 2001 From: John Klug Date: Wed, 11 Nov 2020 16:17:52 -0600 Subject: Add new BSP submodule for Atmel Processors. --- recipes-kernel/rs9113/files/rs9113/wpa_supplicant | 95 +++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100755 recipes-kernel/rs9113/files/rs9113/wpa_supplicant (limited to 'recipes-kernel/rs9113/files/rs9113/wpa_supplicant') diff --git a/recipes-kernel/rs9113/files/rs9113/wpa_supplicant b/recipes-kernel/rs9113/files/rs9113/wpa_supplicant new file mode 100755 index 0000000..6aa6456 --- /dev/null +++ b/recipes-kernel/rs9113/files/rs9113/wpa_supplicant @@ -0,0 +1,95 @@ +#! /bin/sh +# wpa_supplicant +# Example for /etc/init.d +# MTS +# +PATH=/sbin:/bin:/usr/bin:/usr/sbin +PIDFILE=/var/run/wpa_suplicant +CONF=/etc/wpa_supplicant/psk5g.conf +TIMELIMIT=60 +DRIVERNAME=wifi0 +upinterface() { + ((loopcount=1)) + while ((loopcount < TIMELIMIT)) ; do + if [[ $(iw dev ${DRIVERNAME} link) =~ "Connected to " ]] ; then + break; + fi + sleep 1 + ((loopcount++)) + done + ((loopcount=1)) + while ((loopcount < TIMELIMIT)) ; do + ldifs="$IFS" + IFS=$'\n' + result=($(ifup wifi0 2>&1)) + oldifs="$IFS" + show=$(ip addr show) + if [[ ${show} =~ [[:space:]]+inet[[:space:]]*[0-9].*[[:space:]]+global[[:space:]]+wifi0[[:space:]] ]] ; then + break + fi + ifdown wifi0 + sleep 1 + ((loopcount++)) + done + for (( i=0; i < ${#result[@]}; i++ )); do + if [[ ${result[i]} =~ ^[[:space:]]*$ ]] ; then + continue; + fi + logger -t ifup -p daemon.info "${result[i]}" + done +} + +# ntpd init.d script for ntpdc from ntp.isc.org +test -x /usr/sbin/wpa_supplicant -a -r $CONF || exit 0 +if ! [[ -r $CONF ]] ; then + logger -s -t wpa_supplicant -p daemon.err "Cannot find configuration file $CONF" +fi +test -r /etc/default/rcS && . /etc/default/rcS + +# Functions to do individual actions +startdaemon(){ + echo -n "Starting wpa_supplicant: " + /opt/rs9113/onebox_util rpine0 enable_protocol 1 + /opt/rs9113/onebox_util rpine0 set_country 840 + /opt/rs9113/onebox_util rpine0 create_vap ${DRIVERNAME} sta sw_bmiss >/dev/null 2>&1 + start-stop-daemon --start -x wpa_supplicant -- -i ${DRIVERNAME} -D nl80211 -P $PIDFILE /var/run/ -B -c $CONF +} +stopdaemon(){ + echo -n "Stopping ntpd: " + start-stop-daemon --stop -p $PIDFILE + echo "done" +} + +case "$1" in + start) + if ! [[ -f ${CONF} ]] ; then + echo "Skipping. Configuration file ${CONF} not found." + exit 1 + fi + startdaemon + { upinterface & } + ;; + stop) + ifdown ${DRIVERNAME} >/dev/null 2>&1 + stopdaemon + ;; + force-reload) + stopdaemon + startdaemon + ;; + restart) + # Don't reset the tick here + stopdaemon + startdaemon + ;; + reload) + stopdaemon + startdaemon + ;; + *) + echo "Usage: wpa_supplicant { start | stop | restart | reload }" >&2 + exit 1 + ;; +esac + +exit 0 -- cgit v1.2.3