My Code:
Code:
#!/opt/bin/bash
#Initialize, get state
if wl radio | grep 1 &> /dev/null
then
#radio=off, Powerled on
echo "direction=out" > /proc/miscio/gpio_1_config
echo "0" > /proc/miscio/gpio_1
else
#radio=on, Powerled blinks
echo "direction=out" > /proc/miscio/gpio_1_config
echo "2" > /proc/miscio/gpio_1
fi
#Standard Wlan is off after reboot
if wl radio | grep 1 &> /dev/null
then
wl radio on
#Touch HDD to let it spin up (OPTIONAL)
#touch /opt/bin/radio
#Blink powerled fast
echo "direction=out" > /proc/miscio/gpio_1_config
echo "2" > /proc/miscio/gpio_1
else
wl radio off
#Put powerled on
echo "direction=out" > /proc/miscio/gpio_1_config
echo "0" > /proc/miscio/gpio_1
fi
#loop forever
while true
do
#Check if copy button is pressed
if grep 1 /proc/miscio/gpio_6 &> /dev/null
then
if wl radio | grep 1 &> /dev/null
then
wl radio on
#Touch HDD to let it spin up (OPTIONAL)
#touch /opt/bin/radio
#Blink powerled fast
echo "direction=out" > /proc/miscio/gpio_1_config
echo "2" > /proc/miscio/gpio_1
else
wl radio off
#Put powerled on
echo "direction=out" > /proc/miscio/gpio_1_config
echo "0" > /proc/miscio/gpio_1
fi
fi
#Stay here while copy button is still pressed
while grep 1 /proc/miscio/gpio_6 &> /dev/null
do
echo "Just waiting" > /dev/null
done
sleep 1
done
After reboot wlan is off and if u switch wlan on the hdd DONT spin up.
Joe