ramips: setup GPIO chip functions on the fly
[openwrt.git] / package / comgt / files / 3g.sh
index 59e99c7..616beec 100644 (file)
@@ -1,9 +1,10 @@
 set_3g_led() {
        # set on WRT54G3G only
 set_3g_led() {
        # set on WRT54G3G only
-       [ -d /proc/diag ] || return 0
-       grep WRT54G3G /proc/diag/model >/dev/null || return 0
+       [ -f /proc/diag/model ] || return 0
+       grep -q "WRT54G3G" /proc/diag/model >/dev/null || return 0
        echo "$1" > /proc/diag/led/3g_green
        echo "$2" > /proc/diag/led/3g_blue
        echo "$1" > /proc/diag/led/3g_green
        echo "$2" > /proc/diag/led/3g_blue
+       grep -q "WRT54G3G$" /proc/diag/model >/dev/null || return 0
        echo "$3" > /proc/diag/led/3g_blink
 }
 
        echo "$3" > /proc/diag/led/3g_blink
 }
 
@@ -91,10 +92,12 @@ setup_interface_3g() {
                fi
                # Don't assume Option to be default as it breaks with Huawei Cards/Sticks
 
                fi
                # Don't assume Option to be default as it breaks with Huawei Cards/Sticks
 
-               PINCODE="$pincode" gcom -d "$device" -s /etc/gcom/setpin.gcom || {
-                       echo "$config(3g): Failed to set the PIN code."
-                       set_3g_led 0 0 0
-                       return 1
+               test -z "$pincode" || {
+                       PINCODE="$pincode" gcom -d "$device" -s /etc/gcom/setpin.gcom || {
+                               echo "$config(3g): Failed to set the PIN code."
+                               set_3g_led 0 0 0
+                               return 1
+                       }
                }
                test -z "$mode" || {
                        MODE="$mode" gcom -d "$device" -s /etc/gcom/setmode.gcom
                }
                test -z "$mode" || {
                        MODE="$mode" gcom -d "$device" -s /etc/gcom/setmode.gcom
This page took 0.028569 seconds and 4 git commands to generate.