summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorPatrik Flykt <patrik.flykt@linux.intel.com>2013-01-28 15:44:40 (GMT)
committerPatrik Flykt <patrik.flykt@linux.intel.com>2013-01-30 08:28:31 (GMT)
commit672a2f2a0e3022988764a89c4a626cfd7c39ecda (patch)
treea33b83be24c2b15b1c8adcd748bab6666cbce221 /plugins
parent8935565c0d822d81bbe9ec77cfc4de9b2963bfd9 (diff)
downloadconnman-672a2f2a0e3022988764a89c4a626cfd7c39ecda.zip
connman-672a2f2a0e3022988764a89c4a626cfd7c39ecda.tar.gz
connman-672a2f2a0e3022988764a89c4a626cfd7c39ecda.tar.bz2
bluetooth_legacy: Check network in probe function
The network probed can belong to the new Bluez 5 bluetooth plugin or to this plugin. Check if this plugin created the network and proceed accordingly.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/bluetooth_legacy.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/plugins/bluetooth_legacy.c b/plugins/bluetooth_legacy.c
index f03f2a0..62002ef 100644
--- a/plugins/bluetooth_legacy.c
+++ b/plugins/bluetooth_legacy.c
@@ -73,9 +73,22 @@ static GHashTable *pending_networks = NULL;
static int pan_probe(struct connman_network *network)
{
- DBG("network %p", network);
+ GHashTableIter iter;
+ gpointer key, val;
- return 0;
+ g_hash_table_iter_init(&iter, bluetooth_networks);
+ while (g_hash_table_iter_next(&iter, &key, &val) == TRUE) {
+ struct connman_network *known = val;
+
+ if (network != known)
+ continue;
+
+ DBG("network %p", network);
+
+ return 0;
+ }
+
+ return -EOPNOTSUPP;
}
static void pan_remove(struct connman_network *network)
@@ -266,6 +279,7 @@ static int pan_disconnect(struct connman_network *network)
static struct connman_network_driver pan_driver = {
.name = "bluetooth_legacy-pan",
.type = CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN,
+ .priority = CONNMAN_NETWORK_PRIORITY_LOW,
.probe = pan_probe,
.remove = pan_remove,
.connect = pan_connect,
@@ -443,12 +457,12 @@ static void network_properties_reply(DBusPendingCall *call, void *user_data)
connman_network_set_name(network, name);
+ g_hash_table_replace(bluetooth_networks, g_strdup(path), network);
+
connman_device_add_network(device, network);
connman_network_set_group(network, ident);
- g_hash_table_replace(bluetooth_networks, g_strdup(path), network);
-
done:
dbus_message_unref(reply);