DWR-512: adding wwan support for the dwr-512 3G modem
[openwrt/openwrt.git] / package / network / utils / wwan / files / wwan.sh
index 6b33600b32c4028fc9006254307677bb1cedea53..2e9d73f1e2c778b46039d6b8aff6718b3c75954c 100755 (executable)
@@ -66,15 +66,15 @@ proto_wwan_setup() {
                }
        }
 
-       [ -z "$ctl_device" ] && for net in $(ls /sys/class/net/ | grep wwan); do
+       [ -z "$ctl_device" ] && for net in $(ls /sys/class/net/ | grep -e wwan -e usb); do
                [ -z "$ctl_device" ] || continue
                driver=$(grep DRIVER /sys/class/net/$net/device/uevent | cut -d= -f2)
                case "$driver" in
                qmi_wwan|cdc_mbim)
                        ctl_device=/dev/$(ls /sys/class/net/$net/device/usbmisc)
                        ;;
-               sierra_net|*cdc_ncm)
-                       ctl_device=/dev/$(cd /sys/class/net/$net/; find ../../../ -name ttyUSB* |xargs basename | head -n1)
+               sierra_net|cdc_ether|*cdc_ncm)
+                       ctl_device=/dev/$(cd /sys/class/net/$net/; find ../../../ -name ttyUSB* |xargs -n1 basename | head -n1)
                        ;;
                *) continue;;
                esac
@@ -93,11 +93,11 @@ proto_wwan_setup() {
        uci_set_state network $interface dat_device "$dat_device"
 
        case $driver in
-       qmi_wwan)       proto_qmi_setup $@ ;;
-       cdc_mbim)       proto_mbim_setup $@ ;;
-       sierra_net)     proto_directip_setup $@ ;;
-       comgt)          proto_3g_setup $@ ;;
-       *cdc_ncm)       proto_ncm_setup $@ ;;
+       qmi_wwan)               proto_qmi_setup $@ ;;
+       cdc_mbim)               proto_mbim_setup $@ ;;
+       sierra_net)             proto_directip_setup $@ ;;
+       comgt)                  proto_3g_setup $@ ;;
+       cdc_ether|*cdc_ncm)     proto_ncm_setup $@ ;;
        esac
 }
 
@@ -108,11 +108,11 @@ proto_wwan_teardown() {
        dat_device=$(uci_get_state network $interface dat_device)
 
        case $driver in
-       qmi_wwan)       proto_qmi_teardown $@ ;;
-       cdc_mbim)       proto_mbim_teardown $@ ;;
-       sierra_net)     proto_mbim_teardown $@ ;;
-       comgt)          proto_3g_teardown $@ ;;
-       *cdc_ncm)       proto_ncm_teardown $@ ;;
+       qmi_wwan)               proto_qmi_teardown $@ ;;
+       cdc_mbim)               proto_mbim_teardown $@ ;;
+       sierra_net)             proto_mbim_teardown $@ ;;
+       comgt)                  proto_3g_teardown $@ ;;
+       cdc_ether|*cdc_ncm)     proto_ncm_teardown $@ ;;
        esac
 }