From 3daaf7ae5f605dce3d9fc19b5c61843e9d89729c Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 4 Jan 2013 13:44:37 -0800 Subject: [PATCH] core: Remove old function for triggering UUID removal --- src/mgmt.c | 81 +----------------------------------------------------- src/mgmt.h | 1 - 2 files changed, 1 insertion(+), 81 deletions(-) diff --git a/src/mgmt.c b/src/mgmt.c index 56c39878b..12c644231 100644 --- a/src/mgmt.c +++ b/src/mgmt.c @@ -893,14 +893,8 @@ static void uuid_to_uuid128(uuid_t *uuid128, const uuid_t *uuid) static bool is_16bit_uuid(const uuid_t *uuid) { - static uint8_t any[16] = { 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 }; uuid_t tmp; - if (uuid->type == SDP_UUID128 && - memcmp(&uuid->value.uuid128, any, sizeof(any)) == 0) - return true; - uuid_to_uuid128(&tmp, uuid); if (!sdp_uuid128_to_uuid(&tmp)) @@ -960,61 +954,6 @@ int mgmt_add_uuid(int index, uuid_t *uuid, uint8_t svc_hint) return 0; } -int mgmt_remove_uuid(int index, uuid_t *uuid) -{ - char buf[MGMT_HDR_SIZE + sizeof(struct mgmt_cp_remove_uuid)]; - struct mgmt_hdr *hdr = (void *) buf; - struct mgmt_cp_remove_uuid *cp = (void *) &buf[sizeof(*hdr)]; - struct controller_info *info = &controllers[index]; - uuid_t uuid128; - uint128_t uint128; - - DBG("index %d", index); - - if (!is_16bit_uuid(uuid)) { - warn("mgmt_remove_uuid: Ignoring non-16-bit UUID"); - return 0; - } - - if (info->pending_uuid) { - struct pending_uuid *pending = g_new0(struct pending_uuid, 1); - - memcpy(&pending->uuid, uuid, sizeof(*uuid)); - pending->add = false; - - info->pending_uuids = g_slist_append(info->pending_uuids, - pending); - return 0; - } - - uuid_to_uuid128(&uuid128, uuid); - - memset(buf, 0, sizeof(buf)); - hdr->opcode = htobs(MGMT_OP_REMOVE_UUID); - hdr->len = htobs(sizeof(*cp)); - hdr->index = htobs(index); - - ntoh128((uint128_t *) uuid128.value.uuid128.data, &uint128); - htob128(&uint128, (uint128_t *) cp->uuid); - - if (write(mgmt_sock, buf, sizeof(buf)) < 0) - return -errno; - - info->pending_uuid = TRUE; - - return 0; -} - -static int clear_uuids(int index) -{ - uuid_t uuid_any; - - memset(&uuid_any, 0, sizeof(uuid_any)); - uuid_any.type = SDP_UUID128; - - return mgmt_remove_uuid(index, &uuid_any); -} - static void read_index_list_complete(void *buf, size_t len) { struct mgmt_rp_read_index_list *rp = buf; @@ -1137,8 +1076,6 @@ static void read_info_complete(uint16_t index, void *buf, size_t len) DBG("hci%u name %s", index, (char *) rp->name); DBG("hci%u short name %s", index, (char *) rp->short_name); - clear_uuids(index); - if (!mgmt_pairable(info->current_settings)) mgmt_set_pairable(index, TRUE); @@ -1353,8 +1290,6 @@ static void handle_pending_uuids(uint16_t index) if (pending->add) mgmt_add_uuid(index, &pending->uuid, pending->svc_hint); - else - mgmt_remove_uuid(index, &pending->uuid); info->pending_uuids = g_slist_remove(info->pending_uuids, pending); g_free(pending); @@ -1398,20 +1333,6 @@ static void mgmt_add_uuid_complete(uint16_t index, void *buf, size_t len) handle_pending_uuids(index); } -static void mgmt_remove_uuid_complete(uint16_t index, void *buf, size_t len) -{ - DBG("index %d", index); - - if (index > max_index) { - error("Unexpected index %u in remove_uuid_complete event", - index); - return; - } - - mgmt_update_cod(index, buf, len); - handle_pending_uuids(index); -} - static void mgmt_cmd_complete(uint16_t index, void *buf, size_t len) { struct mgmt_ev_cmd_complete *ev = buf; @@ -1460,7 +1381,7 @@ static void mgmt_cmd_complete(uint16_t index, void *buf, size_t len) mgmt_add_uuid_complete(index, ev->data, len); break; case MGMT_OP_REMOVE_UUID: - mgmt_remove_uuid_complete(index, ev->data, len); + DBG("remove_uuid complete"); break; case MGMT_OP_SET_DEV_CLASS: DBG("set_dev_class complete"); diff --git a/src/mgmt.h b/src/mgmt.h index 17f9f1e15..f70627dea 100644 --- a/src/mgmt.h +++ b/src/mgmt.h @@ -48,7 +48,6 @@ 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); int mgmt_add_uuid(int index, uuid_t *uuid, uint8_t svc_hint); -int mgmt_remove_uuid(int index, uuid_t *uuid); int mgmt_set_did(int index, uint16_t vendor, uint16_t product, uint16_t version, uint16_t source); -- 2.47.3