diff --git a/misc/sampleconfigs/autohotspot.sh.stretch-default2-Hotspot.sample b/misc/sampleconfigs/autohotspot.sh.stretch-default2-Hotspot.sample index e4d7d62d4..c8dd1db2e 100644 --- a/misc/sampleconfigs/autohotspot.sh.stretch-default2-Hotspot.sample +++ b/misc/sampleconfigs/autohotspot.sh.stretch-default2-Hotspot.sample @@ -88,7 +88,17 @@ CheckDevice() exit 1 elif (iw dev "$wifidev" info 2>&1 >/dev/null) ; then echo "wifi device available" - return + if (rfkill list wifi -rno HARD,SOFT | grep -i "unblocked.*unblocked") >/dev/null 2>&1 ; then + local wifidev_up=$(ip link show "$wifidev" up) + if [ -z $"wifidev_up" ]; then + ip link set dev "$wifidev" up + sleep 2 + fi + return + else + echo "wifi is deactivated" + exit 0 + fi else j=$((j + 1)) sleep 2 @@ -172,10 +182,7 @@ CheckSSID() fi } + CheckDevice -if rfkill list wifi | grep -i "Soft blocked: no" > /dev/null 2>&1 ; then - FindSSID - CheckSSID -else - echo "skipped - wifi is deactivated." -fi +FindSSID +CheckSSID diff --git a/scripts/playout_controls.sh b/scripts/playout_controls.sh index a02ba9fd5..8a8daa7c9 100755 --- a/scripts/playout_controls.sh +++ b/scripts/playout_controls.sh @@ -120,6 +120,8 @@ if [ "${DEBUG_playout_controls_sh}" == "TRUE" ]; then echo "VAR VALUE: ${VALUE}" # speed of these commands. shortcutCommands="^(setvolume|volumedown|volumeup|mute)$" +autohotspot_script="/usr/bin/autohotspot" + # Run the code from this block only, if the current command is not in "shortcutCommands" if [[ ! "$COMMAND" =~ $shortcutCommands ]] then @@ -1005,6 +1007,7 @@ case $COMMAND in enablewifi) if [ "${DEBUG_playout_controls_sh}" == "TRUE" ]; then echo " ${COMMAND}" >> ${PATHDATA}/../logs/debug.log; fi rfkill unblock wifi + if [ -f $"autohotspot_script" ]; then sudo $"autohotspot_script"; fi ;; disablewifi) if [ "${DEBUG_playout_controls_sh}" == "TRUE" ]; then echo " ${COMMAND}" >> ${PATHDATA}/../logs/debug.log; fi @@ -1030,6 +1033,7 @@ case $COMMAND in if [ "${DEBUG_playout_controls_sh}" == "TRUE" ]; then echo " Wifi will now be activated" >> ${PATHDATA}/../logs/debug.log; fi echo "Wifi will now be activated" rfkill unblock wifi + if [ -f $"autohotspot_script" ]; then sudo $"autohotspot_script"; fi fi ;; randomcard)