From d9ff801460ee610f98b97571311e4af13bb8e1a1 Mon Sep 17 00:00:00 2001 From: Alok Barsode Date: Tue, 22 Jul 2008 19:08:03 +0530 Subject: Adding adapter_create. Signed-off-by: Alok Barsode --- hcid/adapter.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'hcid/adapter.c') diff --git a/hcid/adapter.c b/hcid/adapter.c index 2d0d6e21..f760ebd0 100644 --- a/hcid/adapter.c +++ b/hcid/adapter.c @@ -2539,3 +2539,24 @@ int adapter_update_ssp_mode(struct adapter *adapter, int dd, uint8_t mode) return 0; } + +struct adapter *adapter_create(int id) +{ + char path[MAX_PATH_LENGTH]; + struct adapter *adapter; + + snprintf(path, sizeof(path), "/hci%d", id); + + adapter = g_try_new0(struct adapter, 1); + if (!adapter) { + error("Failed to alloc memory to D-Bus path register data (%s)", + path); + return NULL; + } + + adapter->dev_id = id; + adapter->pdiscov_resolve_names = 1; + adapter->path = g_strdup(path); + + return adapter; +} -- cgit