2010-07-04 18:11:34 +00:00
|
|
|
#!/bin/sh
|
2012-06-05 16:04:23 +00:00
|
|
|
. /lib/functions.sh
|
2011-10-27 20:29:00 +00:00
|
|
|
. /lib/netifd/netifd-proto.sh
|
2010-07-04 18:11:34 +00:00
|
|
|
|
|
|
|
find_3g_iface() {
|
|
|
|
local cfg="$1"
|
|
|
|
local tty="$2"
|
|
|
|
|
|
|
|
local proto
|
|
|
|
config_get proto "$cfg" proto
|
2011-05-04 08:19:07 +00:00
|
|
|
[ "$proto" = 3g ] || return 0
|
2010-07-04 18:11:34 +00:00
|
|
|
|
2012-09-09 19:46:38 +00:00
|
|
|
# bypass state vars here because 00-netstate could clobber .device
|
|
|
|
local dev=$(uci_get network "$cfg" device)
|
2010-07-04 18:11:34 +00:00
|
|
|
|
2011-05-04 08:19:07 +00:00
|
|
|
if [ "${dev##*/}" = "${tty##*/}" ]; then
|
|
|
|
if [ "$ACTION" = add ]; then
|
2011-10-27 20:29:00 +00:00
|
|
|
available=1
|
2011-05-04 08:19:07 +00:00
|
|
|
else
|
2011-10-27 20:29:00 +00:00
|
|
|
available=0
|
2010-07-04 18:11:34 +00:00
|
|
|
fi
|
2011-10-27 20:29:00 +00:00
|
|
|
proto_set_available "$cfg" $available
|
2011-05-04 08:19:07 +00:00
|
|
|
fi
|
2010-07-04 18:11:34 +00:00
|
|
|
}
|
|
|
|
|
2011-05-04 08:19:07 +00:00
|
|
|
case "$DEVICENAME" in
|
|
|
|
tty*)
|
|
|
|
[ -e "/dev/$DEVICENAME" ] || [ "$ACTION" = remove ] || exit 0
|
|
|
|
config_load network
|
|
|
|
config_foreach find_3g_iface interface "/dev/$DEVICENAME"
|
|
|
|
;;
|
|
|
|
esac
|
2010-07-04 18:11:34 +00:00
|
|
|
|