summaryrefslogtreecommitdiffstats
path: root/hcid/dbus-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'hcid/dbus-common.c')
-rw-r--r--hcid/dbus-common.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/hcid/dbus-common.c b/hcid/dbus-common.c
index 3f08e5cd..7bdb2830 100644
--- a/hcid/dbus-common.c
+++ b/hcid/dbus-common.c
@@ -212,6 +212,36 @@ failed:
return -1;
}
+int find_conn(int s, int dev_id, long arg)
+{
+ struct hci_conn_list_req *cl;
+ struct hci_conn_info *ci;
+ int i;
+
+ cl = g_malloc0(10 * sizeof(*ci) + sizeof(*cl));
+
+ cl->dev_id = dev_id;
+ cl->conn_num = 10;
+ ci = cl->conn_info;
+
+ if (ioctl(s, HCIGETCONNLIST, cl)) {
+ error("Can't get connection list");
+ goto failed;
+ }
+
+ for (i = 0; i < cl->conn_num; i++, ci++) {
+ if (bacmp((bdaddr_t *) arg, &ci->bdaddr))
+ continue;
+ g_free(cl);
+ return 1;
+ }
+
+failed:
+ g_free(cl);
+ return 0;
+}
+
+
int check_address(const char *addr)
{
char tmp[18];