#!/bin/sh
-NETWORK="$1"
-WIRELESS="$2"
-
-if [ -z "$NETWORK" ]; then
- NETWORK="homewlan";
-fi;
-
-if [ -z "$WIRELESS" ]; then
- WIRELESS="wireless";
-fi;
+WIRELESS="$1"
# First try a minor cycle
# Failure, so major cycle
sudo ifdown wireless;
-if [ "$WIRELESS" == "wireless" ]; then
- sudo modprobe -r bcm43xx;
- sudo modprobe bcm43xx;
+if [ "$WIRELESS" == "wireless" ]; then
+ if lsmod|grep -q bcm43xx; then
+ sudo modprobe -r bcm43xx;
+ sudo modprobe bcm43xx;
+ else
+ sudo modprobe -r b43;
+ sudo modprobe b43;
+ fi;
+ sleep 2s;
fi;
-sudo ifup "wireless=${NETWORK}";
+sudo ifup "wireless";