MODULE_PATH=/jens/nodes/lib/modules/i586_seismo
WORKING_DIR=/home/kurth/tmp
#CHANNEL=196
CHANNEL=14
#CHANNEL=36
export PATH=${PATH}:/usr/sbin
# startup
insmod ${MODULE_PATH}/wlan.ko
insmod ${MODULE_PATH}/ath_hal.ko
insmod ${MODULE_PATH}/wlan_scan_sta.ko
insmod ${MODULE_PATH}/ath_rate_minstrel.ko
insmod ${MODULE_PATH}/ath_rate_sample.ko
insmod ${MODULE_PATH}/ath_pci.ko  countrycode=395 outdoor=1 # yes, you are Japan
#insmod ${MODULE_PATH}/ath_pci.ko  outdoor=1
wlanconfig ath0 destroy 2>&1 || true
wlanconfig ath1 destroy 2>&1 || true
wlanconfig ath0 create wlandev wifi1 wlanmode monitor # use wifi1 with 11a support
#iwpriv ath0 mode 3      # 802.11bg
#iwpriv ath0 pureg 1     # disable b
#iwpriv ath0 protmode 0  # no ofdm protection
iwpriv ath0 mode 11b     # 802.11a
#iwpriv ath0 mode 11a     # 802.11a
iwpriv ath0 wmm 0       # no multimedia
iwpriv ath0 ar 0        # no adaptive radio
iwpriv ath0 burst 0     # no burst
iwpriv ath0 ff 0        # no fast frame
iwpriv ath0 abolt 0     # no atheros proprietary in general
sysctl -w dev.wifi0.diversity=0  # use fixed antenna
sysctl -w dev.wifi0.txantenna=2  # use fixed antenna
sysctl -w dev.wifi0.rxantenna=2  # use fixed antenna
sysctl -w dev.wifi0.intmit=0     # no ANI
iwconfig ath0 essid WiFiNoDe channel ${CHANNEL} #rate 1M rts off
#iwconfig ath0 txpower
echo '804' > /proc/sys/net/ath0/dev_type
# ip is bogus, but there must be an ip set
ifconfig ath0 10.8.0.1 netmask 255.255.255.0 mtu 2290 up
cd ${WORKING_DIR} && ./click --allow-reconfigure -e "_simDeviceMaster :: SimDeviceMaster(TCP, 7777)" > out.txt 2>&1 &
sleep 5