2011-11-06 18:14:21 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2012-06-16 05:21:27 +03:00
|
|
|
if [ "$1" != "client" ] && [ "$1" != "host" ]; then
|
|
|
|
echo "wpan.nn host|client [dirtpan]"
|
|
|
|
exit 1
|
|
|
|
fi
|
2011-11-06 18:14:21 +02:00
|
|
|
|
2012-06-16 05:21:27 +03:00
|
|
|
uname -a | grep BenNanoNote > /dev/null 2>&1
|
2011-11-06 18:14:21 +02:00
|
|
|
|
2012-06-16 05:21:27 +03:00
|
|
|
if [ "$?" == "0" ]; then
|
|
|
|
echo jz4740-mmc.0 > /sys/bus/platform/drivers/jz4740-mmc/unbind
|
|
|
|
insmod /lib/modules/`uname -r`/at86rf230.ko
|
|
|
|
insmod /lib/modules/`uname -r`/spi_atben.ko
|
|
|
|
fi
|
2011-11-06 18:14:21 +02:00
|
|
|
|
|
|
|
iz add wpan-phy0
|
2012-06-16 05:21:27 +03:00
|
|
|
|
|
|
|
if [ "$1" == "client" ]; then
|
2011-11-08 17:37:55 +02:00
|
|
|
ip link set wpan0 address de:ad:be:af:ca:fe:ba:b2
|
|
|
|
else
|
|
|
|
ip link set wpan0 address de:ad:be:af:ca:fe:ba:b1
|
|
|
|
fi
|
2011-11-06 18:14:21 +02:00
|
|
|
ifconfig wpan0 up
|
|
|
|
|
2012-06-16 05:21:27 +03:00
|
|
|
if [ "$1" == "client" ]; then
|
2011-11-08 17:37:55 +02:00
|
|
|
iz assoc wpan0 777 1 11 short
|
2011-11-06 18:14:21 +02:00
|
|
|
|
2012-06-16 05:21:27 +03:00
|
|
|
if [ "$2" == "dirtpan" ]; then
|
|
|
|
dirtpan 777 8001 1 'ifconfig tun0 10.8.0.2 dstaddr 10.8.0.1 up' &
|
|
|
|
else
|
|
|
|
izchat 777 8001 1
|
|
|
|
fi
|
2011-11-08 17:37:55 +02:00
|
|
|
else
|
|
|
|
rm -f /tmp/lease
|
|
|
|
izcoordinator -d 1 -l /tmp/lease -i wpan0 -p 0x777 -s 1 -c 11 &
|
2011-11-06 18:14:21 +02:00
|
|
|
|
2012-06-16 05:21:27 +03:00
|
|
|
sleep 1
|
|
|
|
|
|
|
|
if [ "$2" == "dirtpan" ]; then
|
|
|
|
dirtpan 777 1 8001 'ifconfig tun0 10.8.0.1 dstaddr 10.8.0.2 up' &
|
|
|
|
else
|
|
|
|
izchat 777 1 8001
|
|
|
|
fi
|
2011-11-08 17:37:55 +02:00
|
|
|
fi
|