From 279a53827334deab5093876e27261d38937bda36 Mon Sep 17 00:00:00 2001 From: Vinicius Costa Gomes Date: Mon, 28 Mar 2011 19:40:47 -0300 Subject: [PATCH] Register Attrib interface when loading device from storage Now that the GATT client functionality is being moved to the core we need to register the interface when the device is created. --- attrib/client.c | 3 +-- attrib/client.h | 2 +- src/adapter.c | 4 ++++ src/device.c | 3 +++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/attrib/client.c b/attrib/client.c index 54bdc793f..590f33b53 100644 --- a/attrib/client.c +++ b/attrib/client.c @@ -1044,12 +1044,11 @@ static void register_primaries(struct gatt_service *gatt, GSList *primaries) } } -int attrib_client_register(struct btd_device *device, int psm) +int attrib_client_register(struct btd_device *device, int psm, GSList *primaries) { struct btd_adapter *adapter = device_get_adapter(device); const char *path = device_get_path(device); struct gatt_service *gatt; - GSList *primaries = btd_device_get_primaries(device); bdaddr_t sba, dba; adapter_get_address(adapter, &sba); diff --git a/attrib/client.h b/attrib/client.h index 50e2b5fba..2bee84ca7 100644 --- a/attrib/client.h +++ b/attrib/client.h @@ -24,5 +24,5 @@ int attrib_client_init(DBusConnection *conn); void attrib_client_exit(void); -int attrib_client_register(struct btd_device *device, int psm); +int attrib_client_register(struct btd_device *device, int psm, GSList *primaries); void attrib_client_unregister(struct btd_device *device); diff --git a/src/adapter.c b/src/adapter.c index 031e14130..26a886089 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -58,6 +58,7 @@ #include "storage.h" #include "attrib-server.h" #include "att.h" +#include "attrib/client.h" /* Flags Descriptions */ #define EIR_LIM_DISC 0x01 /* LE Limited Discoverable Mode */ @@ -2183,6 +2184,9 @@ static void create_stored_device_from_primary(char *key, char *value, device_add_primary(device, prim); } + /* FIXME: Need the correct psm */ + attrib_client_register(device, -1, services); + device_probe_drivers(device, uuids); g_slist_free(services); diff --git a/src/device.c b/src/device.c index 771a908ee..9a3202fae 100644 --- a/src/device.c +++ b/src/device.c @@ -60,6 +60,7 @@ #include "sdp-xml.h" #include "storage.h" #include "btio.h" +#include "attrib/client.h" #define DISCONNECT_TIMER 2 #define DISCOVERY_TIMER 2 @@ -1030,6 +1031,8 @@ void device_remove(struct btd_device *device, gboolean remove_stored) g_slist_free(device->drivers); device->drivers = NULL; + attrib_client_unregister(device); + btd_device_unref(device); } -- 2.47.3