diff options
author | Vinicius Gomes <vinicius.gomes@openbossa.org> | 2008-03-20 14:19:46 +0000 |
---|---|---|
committer | Vinicius Gomes <vinicius.gomes@openbossa.org> | 2008-03-20 14:19:46 +0000 |
commit | 6a3f7979de00988fd66e586097efc5de577f0436 (patch) | |
tree | 5b529b11c36f4fe82f8cb437cf3bb4b33e4edf0a /hcid | |
parent | 79dd6fbaf1115222c723b4b781ad44b07486b00d (diff) |
adapter: adding adapter_get_device function
Diffstat (limited to 'hcid')
-rw-r--r-- | hcid/adapter.c | 18 | ||||
-rw-r--r-- | hcid/adapter.h | 2 |
2 files changed, 20 insertions, 0 deletions
diff --git a/hcid/adapter.c b/hcid/adapter.c index b18b054f..4b1bc0eb 100644 --- a/hcid/adapter.c +++ b/hcid/adapter.c @@ -2130,6 +2130,24 @@ static void create_device_req_free(struct create_device_req *create) create = NULL; } +struct device *adapter_get_device(struct adapter *adapter, const char *src) +{ + struct device *device; + GSList *l; + + if (!adapter) + return NULL; + + l = g_slist_find_custom(adapter->devices, + src, (GCompareFunc) device_address_cmp); + if (!l) + return NULL; + + device = l->data; + + return device; +} + static gboolean create_bonding_conn_complete(GIOChannel *io, GIOCondition cond, struct adapter *adapter) { diff --git a/hcid/adapter.h b/hcid/adapter.h index d64930bc..0ab02c77 100644 --- a/hcid/adapter.h +++ b/hcid/adapter.h @@ -113,6 +113,8 @@ struct adapter { dbus_bool_t adapter_init(DBusConnection *conn, const char *path); +struct device *adapter_get_device(struct adapter *adapter, const char *src); + const char *major_class_str(uint32_t class); const char *minor_class_str(uint32_t class); |