3 [ -f /proc
/diag
/model
] ||
return 0
4 grep -q "WRT54G3G" /proc
/diag
/model
>/dev
/null ||
return 0
5 echo "$1" > /proc
/diag
/led
/3g_green
6 echo "$2" > /proc
/diag
/led
/3g_blue
7 grep -q "WRT54G3G$" /proc
/diag
/model
>/dev
/null ||
return 0
8 echo "$3" > /proc
/diag
/led
/3g_blink
13 config_get device
"$1" device
15 # try to figure out the device if it's invalid
16 [ -n "$device" -a -e "$device" ] ||
{
17 for device
in /dev
/ttyUSB0
/dev
/ttyUSB1
/dev
/ttyUSB2
/dev
/tts
/2 /dev
/usb
/tts
/0 /dev
/noz0
; do
19 config_set
"$1" device
"$device"
25 # enable 3G with the 3G button by default
27 config_get button
"$1" button
29 config_set
"$1" button
1
34 stop_interface_ppp
"$1"
36 killall gcom
>/dev
/null
2>/dev
/null
39 setup_interface_3g
() {
42 local chat
="/etc/chatscripts/3g.chat"
45 config_get device
"$config" device
48 config_get maxwait
"$config" maxwait
49 maxwait
=${maxwait:-20}
50 while [ ! -e "$device" -a $maxwait -gt 0 ];do # wait for driver loading to catch up
51 maxwait
=$
(($maxwait - 1))
55 for module
in slhc ppp_generic ppp_async
; do
56 /sbin
/insmod
$module 2>&- >&-
60 config_get apn
"$config" apn
63 config_get service
"$config" service
66 config_get pincode
"$config" pincode
69 config_get mtu
"$config" mtu
73 # figure out hardware specific commands for the card
75 cdma|evdo
) chat
="/etc/chatscripts/evdo.chat";;
77 cardinfo
=$
(gcom
-d "$device" -s /etc
/gcom
/getcardinfo.gcom
)
78 if echo "$cardinfo" |
grep Novatel
; then
84 mode
="AT\$NWRAT=${CODE},2"
85 elif echo "$cardinfo" |
grep Option
; then
91 mode
="AT_OPSYS=${CODE}"
93 # Don't assume Option to be default as it breaks with Huawei Cards/Sticks
95 test -z "$pincode" ||
{
96 PINCODE
="$pincode" gcom
-d "$device" -s /etc
/gcom
/setpin.gcom ||
{
97 echo "$config(3g): Failed to set the PIN code."
103 MODE
="$mode" gcom
-d "$device" -s /etc
/gcom
/setmode.gcom
108 config_set
"$config" "connect" "${apn:+USE_APN=$apn }/usr/sbin/chat -t5 -v -E -f $chat"
109 start_pppd
"$config" \
117 ${mtu:+mtu $mtu mru $mtu} \