2010年1月26日 星期二

to enable wifi driver and WPA_supplicant

#!/bin/sh
# load wifi driver
insmod sdio.ko
insmod tiwlan_drv.ko
tiwlan_loader
ifconfig tiwlan0 up

#
# the content of /data/misc/wifi/wpa_supplicant.conf
#
# ctrl_interface=/var/run/wpa_supplicant
# ap_scan=1
# update_config=1
#
# #any AP
# network={
# key_mgmt=NONE
# }
#
# #WEP key
# network={
# ssid="xwlan"
# key_mgmt=NONE
# wep_key0="12345"
# wep_key1=31323334353536383930313233
# wep_tx_keyidx=0
# }
#
# #WPA or WPA2
# network={
# ssid="xwlan"
# key_mgmt=WPA-PSK
# psk="hellohello"
# }
#

#make sure /var/run folder is existence
#mkdir /var; mkdir /var/run

# execute wpa_supplicant
wpa_supplicant -Dtiwlan0 -itiwlan0 -c/data/misc/wifi/wpa_supplicant.conf -dd &

# wpa_cli is a CLI application
#wpa_cli -p/var/run/wpa_supplicant

# dispatch ip address
#ifconfig tiwlan0 192.168.5.11 netmask 255.255.255.0 up
/system/bin/dhcpcd -BKL -d tiwlan0 &

# telnetd
#/data/bin/busybox telnetd -l /system/bin/sh