if (g_str_equal(key, "Attached") == TRUE) {
DBG("Attached %d", value);
+ if (modem->attached == value)
+ return;
+
modem->attached = value;
- if (value)
+ if (value == TRUE) {
modem_clear_network_errors(modem);
+ check_networks(modem);
+ }
} else if (g_str_equal(key, "Powered") == TRUE) {
DBG("Powered %d", value);
dbus_pending_call_unref(call);
- check_networks(modem);
}
static void check_gprs(struct modem_data *modem)
if (modem == NULL || modem->device == NULL)
return TRUE;
+ /* Create the related network only when we are attached */
+ if (modem->attached == FALSE)
+ return TRUE;
+
if (dbus_message_iter_init(message, &iter) == FALSE)
return TRUE;