summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlok Barsode <alok.barsode@azingo.com>2008-07-08 20:13:05 +0530
committerLuiz Augusto von Dentz <luiz.dentz@indt.org.br>2008-07-28 10:33:51 -0300
commitdcf5298e8173e946e3ac2ef6150ad78d030b15d0 (patch)
treefebc8dd274a592c05ebff57fc3c1d8263072cc10
parent4e63689794eaa0d5a3567efa8d150110aa648504 (diff)
Adding device_get_adapter.
Signed-off-by: Alok Barsode <alok.barsode@azingo.com>
-rw-r--r--hcid/adapter.c4
-rw-r--r--hcid/dbus-hci.c6
-rw-r--r--hcid/device.c8
-rw-r--r--hcid/device.h1
4 files changed, 15 insertions, 4 deletions
diff --git a/hcid/adapter.c b/hcid/adapter.c
index 434a428b..63414390 100644
--- a/hcid/adapter.c
+++ b/hcid/adapter.c
@@ -254,10 +254,12 @@ static void device_agent_removed(struct agent *agent, void *user_data)
struct device *device = user_data;
struct pending_auth_info *auth;
GSList *l;
+ struct adapter *adapter;
+ adapter = device_get_adapter(device);
device->agent = NULL;
- l = g_slist_find_custom(device->adapter->auth_reqs, agent,
+ l = g_slist_find_custom(adapter->auth_reqs, agent,
auth_info_agent_cmp);
if (!l)
return;
diff --git a/hcid/dbus-hci.c b/hcid/dbus-hci.c
index ccab4077..0b527610 100644
--- a/hcid/dbus-hci.c
+++ b/hcid/dbus-hci.c
@@ -720,7 +720,7 @@ int hcid_dbus_stop_device(uint16_t id)
static void pincode_cb(struct agent *agent, DBusError *err, const char *pincode,
struct device *device)
{
- struct adapter *adapter = device->adapter;
+ struct adapter *adapter = device_get_adapter(device);
pin_code_reply_cp pr;
bdaddr_t sba, dba;
size_t len;
@@ -810,7 +810,7 @@ int hcid_dbus_request_pin(int dev, bdaddr_t *sba, struct hci_conn_info *ci)
static void confirm_cb(struct agent *agent, DBusError *err, void *user_data)
{
struct device *device = user_data;
- struct adapter *adapter = device->adapter;
+ struct adapter *adapter = device_get_adapter(device);
user_confirm_reply_cp cp;
int dd;
struct pending_auth_info *auth;
@@ -849,7 +849,7 @@ static void passkey_cb(struct agent *agent, DBusError *err, uint32_t passkey,
void *user_data)
{
struct device *device = user_data;
- struct adapter *adapter = device->adapter;
+ struct adapter *adapter = device_get_adapter(device);
user_passkey_reply_cp cp;
bdaddr_t dba;
int dd;
diff --git a/hcid/device.c b/hcid/device.c
index 07c294d4..18248267 100644
--- a/hcid/device.c
+++ b/hcid/device.c
@@ -928,6 +928,14 @@ int device_browse(struct device *device, DBusConnection *conn,
return bt_search_service(&src, &dst, &uuid, browse_cb, req, NULL);
}
+struct adapter *device_get_adapter(struct device *device)
+{
+ if (!device)
+ return NULL;
+
+ return device->adapter;
+}
+
int btd_register_device_driver(struct btd_device_driver *driver)
{
const char **uuid;
diff --git a/hcid/device.h b/hcid/device.h
index e5a322b3..c9a5cbc6 100644
--- a/hcid/device.h
+++ b/hcid/device.h
@@ -56,6 +56,7 @@ gint device_address_cmp(struct device *device, const gchar *address);
int device_browse(struct device *device, DBusConnection *conn,
DBusMessage *msg, uuid_t *search);
void device_probe_drivers(struct device *device, GSList *uuids);
+struct adapter *device_get_adapter(struct device *device);
#define BTD_UUIDS(args...) ((const char *[]) { args, NULL } )