#!/bin/sh

if [ "$DEVTYPE" = "usb_device"  ]; then
    if [ "$PRODUCT" = "bda/8172/200" -o "$PRODUCT" = "bda/8174/200" ]; then
	# bring down the interface (just be sure)
	/opt/fastec/scripts/interface_stop wlan0 

	#kill the ifplugd for wlan0 
	kill `cat /var/run/ifplugd.wlan0.pid`
	rm -rf /var/run/ifplugd.wlan0.pid

	#kill the wpa supplicant
	/usr/bin/wpa_cli term 

	#unload the wifi driver
	/sbin/rmmod 8712u
    fi
    if [ "$PRODUCT" = "50d/2103/200" -o "$PRODUCT" == "bda/8178/200" ]; then
	# bring down the interface (just be sure)
	/opt/fastec/scripts/interface_stop wlan0 

	#kill the ifplugd for wlan0 
	kill `cat /var/run/ifplugd.wlan0.pid`
	rm -rf /var/run/ifplugd.wlan0.pid

	#kill the wpa supplicant
	/usr/bin/wpa_cli term 

	#unload the wifi driver
	/sbin/rmmod 8192cu
    fi
fi
