ofono: Ignore non 'hardware' modem types.
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Wed, 23 Nov 2011 16:15:22 +0000 (17:15 +0100)
committerDaniel Wagner <daniel.wagner@bmw-carit.de>
Mon, 12 Dec 2011 16:33:58 +0000 (17:33 +0100)
The HFP modems should not controlled by the ofono plugin. Such
modems are under the control of a dialer.

plugins/ofono.c

index 0e26d40..6ac4f2e 100644 (file)
@@ -100,6 +100,7 @@ struct modem_data {
        connman_bool_t powered;
        connman_bool_t online;
        uint8_t interfaces;
+       connman_bool_t ignore;
 
        connman_bool_t set_powered;
        connman_bool_t set_online;
@@ -1216,6 +1217,9 @@ static gboolean netreg_changed(DBusConnection *connection, DBusMessage *message,
        if (modem == NULL)
                return TRUE;
 
+       if (modem->ignore == TRUE)
+               return TRUE;
+
        if (dbus_message_iter_init(message, &iter) == FALSE)
                return TRUE;
 
@@ -1336,6 +1340,9 @@ static gboolean cm_changed(DBusConnection *connection, DBusMessage *message,
        if (modem == NULL)
                return TRUE;
 
+       if (modem->ignore == TRUE)
+               return TRUE;
+
        if (dbus_message_iter_init(message, &iter) == FALSE)
                return TRUE;
 
@@ -1438,6 +1445,9 @@ static gboolean sim_changed(DBusConnection *connection, DBusMessage *message,
        if (modem == NULL)
                return TRUE;
 
+       if (modem->ignore == TRUE)
+               return TRUE;
+
        if (dbus_message_iter_init(message, &iter) == FALSE)
                return TRUE;
 
@@ -1525,6 +1535,9 @@ static gboolean modem_changed(DBusConnection *connection, DBusMessage *message,
        if (modem == NULL)
                return TRUE;
 
+       if (modem->ignore == TRUE)
+               return TRUE;
+
        if (dbus_message_iter_init(message, &iter) == FALSE)
                return TRUE;
 
@@ -1675,11 +1688,24 @@ static void add_modem(const char *path, DBusMessageIter *prop)
                        modem->serial = g_strdup(serial);
 
                        DBG("%s Serial %s", modem->path, modem->serial);
+               } else if (g_str_equal(key, "Type") == TRUE) {
+                       char *type;
+
+                       dbus_message_iter_get_basic(&value, &type);
+
+                       DBG("%s Type %s", modem->path, type);
+                       if (g_strcmp0(type, "hardware") != 0) {
+                               DBG("%s Ignore this modem", modem->path);
+                               modem->ignore = TRUE;
+                       }
                }
 
                dbus_message_iter_next(prop);
        }
 
+       if (modem->ignore == TRUE)
+               return;
+
        if (modem->powered == FALSE) {
                modem_set_powered(modem);
        } else if (has_interface(modem->interfaces, OFONO_API_SIM) == TRUE) {
@@ -1700,6 +1726,9 @@ static void modem_power_down(gpointer key, gpointer value, gpointer user_data)
 
        DBG("%s", modem->path);
 
+       if (modem->ignore ==  TRUE)
+               return;
+
        modem_set_unpowered(modem);
 }