3g.usb 670 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/sh
  2. . /lib/functions.sh
  3. . /lib/netifd/netifd-proto.sh
  4. find_3g_iface() {
  5. local cfg="$1"
  6. local tty="$2"
  7. local proto
  8. config_get proto "$cfg" proto
  9. [ "$proto" = 3g ] || [ "$proto" = ncm ] || return 0
  10. # bypass state vars here because 00-netstate could clobber .device
  11. local dev=$(uci_get network "$cfg" device)
  12. if [ "${dev##*/}" = "${tty##*/}" ]; then
  13. if [ "$ACTION" = add ]; then
  14. available=1
  15. else
  16. available=0
  17. fi
  18. proto_set_available "$cfg" $available
  19. fi
  20. }
  21. case "$DEVICENAME" in
  22. tty*)
  23. [ -e "/dev/$DEVICENAME" ] || [ "$ACTION" = remove ] || exit 0
  24. config_load network
  25. config_foreach find_3g_iface interface "/dev/$DEVICENAME"
  26. ;;
  27. esac