From: Johan Hedberg Date: Thu, 9 Feb 2012 12:32:30 +0000 (+0200) Subject: adapter_ops: Add address type to disconnect() X-Git-Tag: android-x86-4.4-r3~13604 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=e6f57ce4edf7a50042ca3fd25bc5e30bc60f37fd;p=android-x86%2Fexternal-bluetooth-bluez.git adapter_ops: Add address type to disconnect() --- diff --git a/plugins/hciops.c b/plugins/hciops.c index c51ddcf81..1048bf6e1 100644 --- a/plugins/hciops.c +++ b/plugins/hciops.c @@ -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); diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c index a2df3f770..c0af8d85f 100644 --- a/plugins/mgmtops.c +++ b/plugins/mgmtops.c @@ -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); diff --git a/src/adapter.c b/src/adapter.c index e7c71b0bf..099b1c223 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -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, diff --git a/src/adapter.h b/src/adapter.h index f83e4127c..f99eb1946 100644 --- a/src/adapter.h +++ b/src/adapter.h @@ -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); diff --git a/src/device.c b/src/device.c index c91e32127..38038137e 100644 --- a/src/device.c +++ b/src/device.c @@ -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; }