OSDN Git Service

adapter_ops: Add address type to disconnect()
authorJohan Hedberg <johan.hedberg@intel.com>
Thu, 9 Feb 2012 12:32:30 +0000 (14:32 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Thu, 9 Feb 2012 15:24:26 +0000 (17:24 +0200)
plugins/hciops.c
plugins/mgmtops.c
src/adapter.c
src/adapter.h
src/device.c

index c51ddcf..1048bf6 100644 (file)
@@ -3352,7 +3352,7 @@ static int hciops_get_conn_list(int index, GSList **conns)
        return 0;
 }
 
-static int hciops_disconnect(int index, bdaddr_t *bdaddr)
+static int hciops_disconnect(int index, bdaddr_t *bdaddr, addr_type_t type)
 {
        DBG("hci%d", index);
 
index a2df3f7..c0af8d8 100644 (file)
@@ -1818,7 +1818,7 @@ static int mgmt_get_conn_list(int index, GSList **conns)
        return 0;
 }
 
-static int mgmt_disconnect(int index, bdaddr_t *bdaddr)
+static int mgmt_disconnect(int index, bdaddr_t *bdaddr, addr_type_t type)
 {
        char buf[MGMT_HDR_SIZE + sizeof(struct mgmt_cp_disconnect)];
        struct mgmt_hdr *hdr = (void *) buf;
@@ -1834,6 +1834,7 @@ static int mgmt_disconnect(int index, bdaddr_t *bdaddr)
        hdr->index = htobs(index);
 
        bacpy(&cp->addr.bdaddr, bdaddr);
+       cp->addr.type = mgmt_addr_type(type);
 
        if (write(mgmt_sock, buf, sizeof(buf)) < 0)
                error("write: %s (%d)", strerror(errno), errno);
index e7c71b0..099b1c2 100644 (file)
@@ -3509,9 +3509,11 @@ int btd_adapter_read_clock(struct btd_adapter *adapter, bdaddr_t *bdaddr,
                                                timeout, clock, accuracy);
 }
 
-int btd_adapter_disconnect_device(struct btd_adapter *adapter, bdaddr_t *bdaddr)
+int btd_adapter_disconnect_device(struct btd_adapter *adapter,
+                                       bdaddr_t *bdaddr, addr_type_t type)
+
 {
-       return adapter_ops->disconnect(adapter->dev_id, bdaddr);
+       return adapter_ops->disconnect(adapter->dev_id, bdaddr, type);
 }
 
 int btd_adapter_remove_bonding(struct btd_adapter *adapter, bdaddr_t *bdaddr,
index f83e412..f99eb19 100644 (file)
@@ -196,7 +196,7 @@ struct btd_adapter_ops {
        int (*block_device) (int index, bdaddr_t *bdaddr);
        int (*unblock_device) (int index, bdaddr_t *bdaddr);
        int (*get_conn_list) (int index, GSList **conns);
-       int (*disconnect) (int index, bdaddr_t *bdaddr);
+       int (*disconnect) (int index, bdaddr_t *bdaddr, addr_type_t type);
        int (*remove_bonding) (int index, bdaddr_t *bdaddr, addr_type_t type);
        int (*pincode_reply) (int index, bdaddr_t *bdaddr, const char *pin,
                                                        size_t pin_len);
@@ -248,7 +248,7 @@ int btd_adapter_block_address(struct btd_adapter *adapter, bdaddr_t *bdaddr);
 int btd_adapter_unblock_address(struct btd_adapter *adapter, bdaddr_t *bdaddr);
 
 int btd_adapter_disconnect_device(struct btd_adapter *adapter,
-                                                       bdaddr_t *bdaddr);
+                                       bdaddr_t *bdaddr, addr_type_t type);
 
 int btd_adapter_remove_bonding(struct btd_adapter *adapter, bdaddr_t *bdaddr,
                                                        addr_type_t type);
index c91e321..3803813 100644 (file)
@@ -479,7 +479,8 @@ static gboolean do_disconnect(gpointer user_data)
 
        device->disconn_timer = 0;
 
-       btd_adapter_disconnect_device(device->adapter, &device->bdaddr);
+       btd_adapter_disconnect_device(device->adapter, &device->bdaddr,
+                                                               device->type);
 
        return FALSE;
 }