]> git.ipfire.org Git - people/stevee/network.git/commitdiff
modem: Wait a moment after initializing.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 19 May 2013 17:50:44 +0000 (19:50 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 19 May 2013 17:50:44 +0000 (19:50 +0200)
Some UMTS modems need some extra seconds to initialize
themselves after reset, so we wait a short moment...

functions.modem
udev/network-hotplug-serial

index b23d68b5854a83348c827c908facf22ced07cf12..8b115fca429f3b55e8a576cd8a1fd182b5fe8c71 100644 (file)
@@ -129,11 +129,34 @@ function __modem_chat_process_output() {
 function modem_initialize() {
        local device="${1}"
        assert isset device
+       shift
+
+       # Sleep for $sleep seconds, to give
+       # the modem a moment to initialize itself.
+       local sleep=1
+
+       while [ $# -gt 0 ]; do
+               case "${1}" in
+                       --sleep=*)
+                               sleep="$(cli_get_val "${1}")"
+                               ;;
+                       *)
+                               warning "Unrecognized argument: ${1}"
+                               ;;
+               esac
+               shift
+       done
+       assert isinteger sleep
 
        log INFO "Initializing modem ${device}"
 
        # Reset the modem.
        modem_chat "${device}" "${AT_INITIALIZE}"
+
+       # Wait...
+       if [ ${sleep} -gt 0 ]; then
+               sleep ${sleep}
+       fi
 }
 
 # Exit codes of the sim_status function.
index ead51af6ffcabc054d802720e4ada939f4cb16c6..cb40768ef189d8cf2421285644e4f5613a606bf9 100755 (executable)
@@ -76,7 +76,7 @@ case "${ACTION}" in
 
                # Initialize the modem here. Resets all established connections
                # and so on.
-               modem_initialize "${DEVNAME}"
+               modem_initialize "${DEVNAME}" --sleep=3
 
                # Unlock the SIM card if it has one.
                if modem_sim_locked "${DEVNAME}"; then