User:Piccobello/Wireless
< User:Piccobello
Revision as of 16:49, 5 September 2006 by Piccobello (Talk | contribs)
My /etc/acpi/wireless.sh with lots of debugging info
#!/bin/bash
# Find and enable/disable wireless devices
for DEVICE in /sys/class/net/*; do
if [ -d $DEVICE/wireless ]; then
# $DEVICE is a wireless device. Check if it's powered on:
echo $DEVICE power state `cat $DEVICE/device/power/state`
if [ `cat $DEVICE/device/power/state` = 0 ]; then
# It's powered on. Switch it off.
echo Switching off
echo -n 3 > $DEVICE/device/power/state;
echo $DEVICE power state `cat $DEVICE/device/power/state`
#Check SW kill switch status
#see /usr/src/linux-source-2.6.12/Documentation/networking/README.ipw2100
if [ -e $DEVICE/device/rf_kill ]; then
echo $DEVICE rf_kill `cat $DEVICE/device/rf_kill`
if [ `cat $DEVICE/device/rf_kill` = 0 ]; then
echo -n 1 > $DEVICE/device/rf_kill
echo $DEVICE rf_kill `cat $DEVICE/device/rf_kill`
fi
fi
echo 0
else
# It's powered off. Switch it on.
echo Switching on
echo -n 0 > $DEVICE/device/power/state;
echo $DEVICE power state `cat $DEVICE/device/power/state`
#Check SW kill switch status
#see /usr/src/linux-source-2.6.12/Documentation/networking/README.ipw2100
if [ -e $DEVICE/device/rf_kill ]; then
echo $DEVICE rf_kill `cat $DEVICE/device/rf_kill`
if [ `cat $DEVICE/device/rf_kill` -gt 0 ]; then
echo -n 0 > $DEVICE/device/rf_kill
echo $DEVICE rf_kill `cat $DEVICE/device/rf_kill`
fi
fi
echo 1
fi
fi
done