From: Michael Tremer Date: Sun, 19 May 2013 17:50:44 +0000 (+0200) Subject: modem: Wait a moment after initializing. X-Git-Tag: 007~125 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3255c8944144c5ee043cfb2c5e42bf719f23b8ac;p=network.git modem: Wait a moment after initializing. Some UMTS modems need some extra seconds to initialize themselves after reset, so we wait a short moment... --- diff --git a/functions.modem b/functions.modem index b23d68b5..8b115fca 100644 --- a/functions.modem +++ b/functions.modem @@ -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. diff --git a/udev/network-hotplug-serial b/udev/network-hotplug-serial index ead51af6..cb40768e 100755 --- a/udev/network-hotplug-serial +++ b/udev/network-hotplug-serial @@ -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