#!/bin/sh
#
# Change Atheros MCS 
# Author: Tipo Man

vendor=$(ipcinfo -v)

case "$1" in
	"1")	   
	  echo '1-1' > /sys/bus/usb/drivers/usb/unbind
	  if [ ${vendor} = "ingenic" ]; then
		  rm /lib/firmware/htc_9271.fw
		  ln -s /lib/firmware/ath9k_htc/htc_9271.fw.1 /lib/firmware/htc_9271.fw
	  else
		  rm /lib/firmware/ath9k_htc/htc_9271-1.4.0.fw
		  ln -s /lib/firmware/ath9k_htc/htc_9271.fw.1 /lib/firmware/ath9k_htc/htc_9271-1.4.0.fw
	  fi
	  echo '1-1' > /sys/bus/usb/drivers/usb/bind
	  echo "Loaded firmware with MCS"$1
	;;
	"3")		
	  echo '1-1' > /sys/bus/usb/drivers/usb/unbind
	  if [ ${vendor} = "ingenic" ]; then
		  rm /lib/firmware/htc_9271.fw
		  ln -s /lib/firmware/ath9k_htc/htc_9271.fw.3 /lib/firmware/htc_9271.fw
	  else
		  rm /lib/firmware/ath9k_htc/htc_9271-1.4.0.fw
		  ln -s /lib/firmware/ath9k_htc/htc_9271.fw.3 /lib/firmware/ath9k_htc/htc_9271-1.4.0.fw
	  fi
	  echo '1-1' > /sys/bus/usb/drivers/usb/bind
	  echo "Loaded firmware with MCS"$1
	;;
	*)
	  echo "Only MCS 1 or 3 supported!"
	;;
esac