Skip to content

Commit

Permalink
fix for deactivated wifi on startup
Browse files Browse the repository at this point in the history
also check for hard blocked wifi
  • Loading branch information
AlvinSchiller committed Nov 3, 2023
1 parent 51e7b77 commit 7417a09
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
21 changes: 14 additions & 7 deletions misc/sampleconfigs/autohotspot.sh.stretch-default2-Hotspot.sample
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
4 changes: 4 additions & 0 deletions scripts/playout_controls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 7417a09

Please sign in to comment.