#!/bin/sh # written by Benedikt Grande # @todo method to enable/disable sound # case to enable/disable sound # modules to load/unload # brcmsmac WIFIMOD_DIS="brcmsmac brcmutil mac80211 cfg80211 bcma" WIFIMOD_EN="bcma" BTMOD_DIS="rfcomm bnep btusb bluetooth" BTMOD_EN="btusb" SNDMOD_DIS="" # disable wifi wifi_disable () { /usr/bin/dropbox stop /sbin/ifconfig wlan0 down rfkill block wifi # we might unload the modules now /sbin/modprobe -r $WIFIMOD_DIS } # disable bluetooth bt_disable () { /etc/init.d/bluetooth stop /usr/sbin/hciconfig hci0 down rfkill block bluetooth # we might unload the modules now /sbin/modprobe -r $BTMOD_DIS } # disable sound snd_disable () { echo "Nothing yet" } # enable wifi wifi_enable () { modprobe $WIFIMOD_EN rfkill unblock wifi /bin/sleep 1 /sbin/ifconfig wlan0 up /usr/bin/dropbox start } # enable bluetooth bt_enable () { /etc/init.d/bluetooth start /sbin/modprobe $BTMOD_EN rfkill unblock bluetooth /bin/sleep 1 #/usr/sbin/hciconfig hci0 up } # enable sound snd_enable () { echo "Nothing yet" } case "$1" in enable|disable) bt_${1} wifi_${1} # make sure all power save features are enabled # this is a workaround! We should be more specific! sh /etc/pm/power.d/96_powersave true ;; bt_enable) bt_enable ;; bt_disable) bt_disable ;; wifi_enable) wifi_enable ;; wifi_disable) wifi_disable ;; *) USAGE="sh $0" echo "Usage:" echo "$USAGE enable - enable bt and wifi" echo "$USAGE disable - disable bt and wifi" echo "$USAGE bt_enable - enable bluetooth" echo "$USAGE bt_disable - disable bluetooth" echo "$USAGE wifi_enable - enable wifi" echo "$USAGE wifi disable - disable wifi" ;; esac