diff --git a/src/adapter.c b/src/adapter.c
index e154c69..6731444 100644
--- a/src/adapter.c
+++ b/src/adapter.c
adapter->profiles = g_slist_prepend(adapter->profiles, profile);
}
+void adapter_add_profile(struct btd_adapter *adapter, gpointer p)
+{
+ struct btd_profile *profile = p;
+
+ if (!adapter->initialized)
+ return;
+
+ probe_profile(profile, adapter);
+
+ g_slist_foreach(adapter->devices, device_probe_profile, profile);
+}
+
static void load_connections(struct btd_adapter *adapter)
{
GSList *l, *conns;
diff --git a/src/adapter.h b/src/adapter.h
index eece6f5..9f840e8 100644
--- a/src/adapter.h
+++ b/src/adapter.h
typedef void (*service_auth_cb) (DBusError *derr, void *user_data);
+void adapter_add_profile(struct btd_adapter *adapter, gpointer p);
int btd_register_adapter_driver(struct btd_adapter_driver *driver);
void btd_unregister_adapter_driver(struct btd_adapter_driver *driver);
int btd_request_authorization(const bdaddr_t *src, const bdaddr_t *dst,
diff --git a/src/device.c b/src/device.c
index 57fdf00..cb25606 100644
--- a/src/device.c
+++ b/src/device.c
g_slist_free(probe_uuids);
}
+void device_probe_profile(gpointer a, gpointer b)
+{
+ struct btd_device *device = a;
+ struct btd_profile *profile = b;
+ GSList *probe_uuids;
+ char addr[18];
+ int err;
+
+ if (profile->device_probe == NULL)
+ return;
+
+ probe_uuids = device_match_profile(device, profile, device->uuids);
+ if (!probe_uuids)
+ return;
+
+ ba2str(&device->bdaddr, addr);
+
+ err = profile->device_probe(profile, device, probe_uuids);
+ if (err < 0)
+ error("%s profile probe failed for %s", profile->name, addr);
+ else
+ device->profiles = g_slist_append(device->profiles, profile);
+
+ g_slist_free(probe_uuids);
+}
+
void device_probe_profiles(struct btd_device *device, GSList *uuids)
{
struct probe_data d = { device, uuids };
diff --git a/src/device.h b/src/device.h
index aee6d13..02c1782 100644
--- a/src/device.h
+++ b/src/device.h
GSList *device_services_from_record(struct btd_device *device,
GSList *profiles);
void btd_device_add_uuid(struct btd_device *device, const char *uuid);
+void device_probe_profile(gpointer a, gpointer b);
struct btd_adapter *device_get_adapter(struct btd_device *device);
void device_get_address(struct btd_device *device, bdaddr_t *bdaddr,
uint8_t *bdaddr_type);