diff options
author | Pekka Pessi <Pekka.Pessi@nokia.com> | 2011-01-26 16:50:39 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-01-27 11:09:06 +0100 |
commit | 894d6aada90e56880934f93c26cb04f99ed9b162 (patch) | |
tree | caee70d9aa3e32c40c63b576ddfda98a7d356079 /plugins/ofono.c | |
parent | 5af5021b29d4bdf702bfd066334e097bbd064ed3 (diff) | |
download | connman-894d6aada90e56880934f93c26cb04f99ed9b162.tar.gz connman-894d6aada90e56880934f93c26cb04f99ed9b162.tar.bz2 connman-894d6aada90e56880934f93c26cb04f99ed9b162.zip |
ofono: be proactive when connecting
Return error immediately if connection attempts are known to fail.
Diffstat (limited to 'plugins/ofono.c')
-rw-r--r-- | plugins/ofono.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/plugins/ofono.c b/plugins/ofono.c index 90b579d2..3afe0f89 100644 --- a/plugins/ofono.c +++ b/plugins/ofono.c @@ -471,11 +471,25 @@ static void set_apn(struct connman_network *network) static int network_connect(struct connman_network *network) { + struct connman_device *device; + struct modem_data *modem; + DBG("network %p", network); if (connman_network_get_index(network) >= 0) return -EISCONN; + device = connman_network_get_device(network); + if (device == NULL) + return -ENODEV; + + modem = connman_device_get_data(device); + if (modem == NULL) + return -ENODEV; + + if (modem->powered == FALSE) + return -ENOLINK; + return set_network_active(network, TRUE); } |