source: trunk/package/comgt/files/3g.usb @ 33350

Last change on this file since 33350 was 33350, checked in by jow, 4 years ago

[package] comgt: fix 3g redialling if dongle is physically reattached (#11567, #12008)

File size: 648 bytes
Line 
1#!/bin/sh
2. /lib/functions.sh
3. /lib/netifd/netifd-proto.sh
4
5find_3g_iface() {
6        local cfg="$1"
7        local tty="$2"
8
9        local proto
10        config_get proto "$cfg" proto
11        [ "$proto" = 3g ] || return 0
12
13        # bypass state vars here because 00-netstate could clobber .device
14        local dev=$(uci_get network "$cfg" device)
15
16        if [ "${dev##*/}" = "${tty##*/}" ]; then
17                if [ "$ACTION" = add ]; then
18                        available=1
19                else
20                        available=0
21                fi
22                proto_set_available "$cfg" $available
23        fi
24}
25
26case "$DEVICENAME" in
27        tty*)
28                [ -e "/dev/$DEVICENAME" ] || [ "$ACTION" = remove ] || exit 0
29                config_load network
30                config_foreach find_3g_iface interface "/dev/$DEVICENAME"
31        ;;
32esac
33
Note: See TracBrowser for help on using the repository browser.