dundee: Check ownership of device
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Fri, 1 Jun 2012 14:11:29 +0000 (16:11 +0200)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Mon, 4 Jun 2012 13:20:59 +0000 (16:20 +0300)
We have two drivers for the CONNMAN_DEVICE_TYPE_BLUETOOTH and therefore
check owner ship in probe function.

plugins/dundee.c

index e756b6d..19479ac 100644 (file)
@@ -339,9 +339,24 @@ static struct connman_network_driver network_driver = {
 
 static int dundee_probe(struct connman_device *device)
 {
+       GHashTableIter iter;
+       gpointer key, value;
+
        DBG("device %p", device);
 
-       return 0;
+       if (dundee_devices == NULL)
+               return -ENOTSUP;
+
+       g_hash_table_iter_init(&iter, dundee_devices);
+
+       while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) {
+               struct connman_device *device_dun = value;
+
+               if (device == device_dun)
+                       return 0;
+       }
+
+       return -ENOTSUP;
 }
 
 static void dundee_remove(struct connman_device *device)