From a06282d0521778b1a130c2c28eab8f553aed2d8e Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 5 Jan 2013 00:29:06 -0800 Subject: [PATCH] core: Remove double tracking of existing connections --- src/mgmt.c | 66 +----------------------------------------------------- src/mgmt.h | 2 -- 2 files changed, 1 insertion(+), 67 deletions(-) diff --git a/src/mgmt.c b/src/mgmt.c index 9e75389ab..dbebdc8c7 100644 --- a/src/mgmt.c +++ b/src/mgmt.c @@ -57,7 +57,6 @@ static int max_index = -1; static struct controller_info { gboolean valid; uint32_t current_settings; - GSList *connections; uint8_t discov_type; } *controllers = NULL; @@ -129,21 +128,6 @@ static void read_info(uint16_t index) strerror(errno), errno); } -static void get_connections(uint16_t index) -{ - struct mgmt_hdr hdr; - - DBG("index %u", index); - - memset(&hdr, 0, sizeof(hdr)); - hdr.opcode = htobs(MGMT_OP_GET_CONNECTIONS); - hdr.index = htobs(index); - - if (write(mgmt_sock, &hdr, sizeof(hdr)) < 0) - error("Unable to send get_connections command: %s (%d)", - strerror(errno), errno); -} - static void mgmt_index_added(uint16_t index) { DBG("index %u", index); @@ -728,9 +712,6 @@ static void read_info_complete(uint16_t index, void *buf, size_t len) DBG("hci%u settings", index); DBG("hci%u name %s", index, (char *) rp->name); DBG("hci%u short name %s", index, (char *) rp->short_name); - - if (mgmt_powered(rp->current_settings)) - get_connections(index); } static void disconnect_complete(uint16_t index, uint8_t status, @@ -793,39 +774,6 @@ static void pair_device_complete(uint16_t index, uint8_t status, bonding_complete(index, &rp->addr, status); } -static void get_connections_complete(uint16_t index, void *buf, size_t len) -{ - struct mgmt_rp_get_connections *rp = buf; - struct controller_info *info; - int i; - - if (len < sizeof(*rp)) { - error("Too small get_connections complete event"); - return; - } - - if (len < (sizeof(*rp) + (rp->conn_count * sizeof(bdaddr_t)))) { - error("Too small get_connections complete event"); - return; - } - - if (index > max_index) { - error("Unexpected index %u in get_connections complete", - index); - return; - } - - info = &controllers[index]; - - for (i = 0; i < rp->conn_count; i++) { - struct mgmt_addr_info *addr; - - addr = g_memdup(&rp->addr[i], sizeof(*addr)); - - info->connections = g_slist_append(info->connections, addr); - } -} - static void read_local_oob_data_complete(uint16_t index, void *buf, size_t len) { struct mgmt_rp_read_local_oob_data *rp = buf; @@ -962,7 +910,7 @@ static void mgmt_cmd_complete(uint16_t index, void *buf, size_t len) disconnect_complete(index, ev->status, ev->data, len); break; case MGMT_OP_GET_CONNECTIONS: - get_connections_complete(index, ev->data, len); + DBG("get_connections complete"); break; case MGMT_OP_PIN_CODE_REPLY: DBG("pin_code_reply complete"); @@ -1674,18 +1622,6 @@ int mgmt_unblock_device(int index, const bdaddr_t *bdaddr, uint8_t bdaddr_type) return 0; } -int mgmt_get_conn_list(int index, GSList **conns) -{ - struct controller_info *info = &controllers[index]; - - DBG("index %d", index); - - *conns = info->connections; - info->connections = NULL; - - return 0; -} - int mgmt_disconnect(int index, const bdaddr_t *bdaddr, uint8_t bdaddr_type) { char buf[MGMT_HDR_SIZE + sizeof(struct mgmt_cp_disconnect)]; diff --git a/src/mgmt.h b/src/mgmt.h index 8fe149a23..5fa214ff8 100644 --- a/src/mgmt.h +++ b/src/mgmt.h @@ -32,8 +32,6 @@ int mgmt_stop_discovery(int index); int mgmt_block_device(int index, const bdaddr_t *bdaddr, uint8_t bdaddr_type); int mgmt_unblock_device(int index, const bdaddr_t *bdaddr, uint8_t bdaddr_type); -int mgmt_get_conn_list(int index, GSList **conns); - int mgmt_disconnect(int index, const bdaddr_t *bdaddr, uint8_t bdaddr_type); int mgmt_unpair_device(int index, const bdaddr_t *bdaddr, uint8_t bdaddr_type); -- 2.47.3