Diff between 7ee8ea022d568ab5d6df7dd6d82841ffa7696fa9 and 4c63c025a56e0804b8f4d76326a803c40c5d5d38

Changed Files

File Additions Deletions Status
lib/mgmt.h +9 -9 modified
mgmt/main.c +6 -6 modified
plugins/mgmtops.c +16 -16 modified

Full Patch

diff --git a/lib/mgmt.h b/lib/mgmt.h
index 6e39596..3b3a71c 100644
--- a/lib/mgmt.h
+++ b/lib/mgmt.h
@@ -110,22 +110,22 @@ struct mgmt_cp_set_service_cache {
 	uint8_t enable;
 } __packed;
 
-struct mgmt_key_info {
+struct mgmt_link_key_info {
 	bdaddr_t bdaddr;
 	uint8_t type;
 	uint8_t val[16];
 	uint8_t pin_len;
 } __packed;
 
-#define MGMT_OP_LOAD_KEYS		0x000D
-struct mgmt_cp_load_keys {
+#define MGMT_OP_LOAD_LINK_KEYS		0x000D
+struct mgmt_cp_load_link_keys {
 	uint8_t debug_keys;
 	uint16_t key_count;
-	struct mgmt_key_info keys[0];
+	struct mgmt_link_key_info keys[0];
 } __packed;
 
-#define MGMT_OP_REMOVE_KEY		0x000E
-struct mgmt_cp_remove_key {
+#define MGMT_OP_REMOVE_KEYS		0x000E
+struct mgmt_cp_remove_keys {
 	bdaddr_t bdaddr;
 	uint8_t disconnect;
 } __packed;
@@ -263,10 +263,10 @@ struct mgmt_ev_controller_error {
 
 #define MGMT_EV_PAIRABLE		0x0009
 
-#define MGMT_EV_NEW_KEY			0x000A
-struct mgmt_ev_new_key {
+#define MGMT_EV_NEW_LINK_KEY		0x000A
+struct mgmt_ev_new_link_key {
 	uint8_t store_hint;
-	struct mgmt_key_info key;
+	struct mgmt_link_key_info key;
 } __packed;
 
 #define MGMT_EV_DEVICE_CONNECTED	0x000B
diff --git a/mgmt/main.c b/mgmt/main.c
index ac0e96e..f0eba5c 100644
--- a/mgmt/main.c
+++ b/mgmt/main.c
@@ -312,12 +312,12 @@ static int mgmt_setting(int mgmt_sk, uint16_t index, uint16_t op,
 	return 0;
 }
 
-static int mgmt_new_key(int mgmt_sk, uint16_t index,
-				struct mgmt_ev_new_key *ev, uint16_t len)
+static int mgmt_new_link_key(int mgmt_sk, uint16_t index,
+				struct mgmt_ev_new_link_key *ev, uint16_t len)
 {
 
 	if (len != sizeof(*ev)) {
-		fprintf(stderr, "Invalid new_key event length (%u bytes)\n",
+		fprintf(stderr, "Invalid new_link_key length (%u bytes)\n",
 									len);
 		return -EINVAL;
 	}
@@ -325,7 +325,7 @@ static int mgmt_new_key(int mgmt_sk, uint16_t index,
 	if (monitor) {
 		char addr[18];
 		ba2str(&ev->key.bdaddr, addr);
-		printf("hci%u new_key %s type 0x%02x pin_len %d "
+		printf("hci%u new_link_key %s type 0x%02x pin_len %d "
 				"store_hint %u\n", index, addr, ev->key.type,
 				ev->key.pin_len, ev->store_hint);
 	}
@@ -494,8 +494,8 @@ static int mgmt_handle_event(int mgmt_sk, uint16_t ev, uint16_t index,
 	case MGMT_EV_PAIRABLE:
 	case MGMT_EV_DISCOVERING:
 		return mgmt_setting(mgmt_sk, index, ev, data, len);
-	case MGMT_EV_NEW_KEY:
-		return mgmt_new_key(mgmt_sk, index, data, len);
+	case MGMT_EV_NEW_LINK_KEY:
+		return mgmt_new_link_key(mgmt_sk, index, data, len);
 	case MGMT_EV_DEVICE_CONNECTED:
 		return mgmt_connected(mgmt_sk, index, true, data, len);
 	case MGMT_EV_DEVICE_DISCONNECTED:
diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
index 68d13ef..61d17ad 100644
--- a/plugins/mgmtops.c
+++ b/plugins/mgmtops.c
@@ -393,9 +393,9 @@ static void mgmt_pairable(int sk, uint16_t index, void *buf, size_t len)
 	btd_adapter_pairable_changed(adapter, info->pairable);
 }
 
-static void mgmt_new_key(int sk, uint16_t index, void *buf, size_t len)
+static void mgmt_new_link_key(int sk, uint16_t index, void *buf, size_t len)
 {
-	struct mgmt_ev_new_key *ev = buf;
+	struct mgmt_ev_new_link_key *ev = buf;
 	struct controller_info *info;
 
 	if (len != sizeof(*ev)) {
@@ -1174,11 +1174,11 @@ static void mgmt_cmd_complete(int sk, uint16_t index, void *buf, size_t len)
 	case MGMT_OP_SET_SERVICE_CACHE:
 		DBG("set_service_cache complete");
 		break;
-	case MGMT_OP_LOAD_KEYS:
-		DBG("load_keys complete");
+	case MGMT_OP_LOAD_LINK_KEYS:
+		DBG("load_link_keys complete");
 		break;
-	case MGMT_OP_REMOVE_KEY:
-		DBG("remove_key complete");
+	case MGMT_OP_REMOVE_KEYS:
+		DBG("remove_keys complete");
 		break;
 	case MGMT_OP_DISCONNECT:
 		DBG("disconnect complete");
@@ -1530,8 +1530,8 @@ static gboolean mgmt_event(GIOChannel *io, GIOCondition cond, gpointer user_data
 	case MGMT_EV_PAIRABLE:
 		mgmt_pairable(sk, index, buf + MGMT_HDR_SIZE, len);
 		break;
-	case MGMT_EV_NEW_KEY:
-		mgmt_new_key(sk, index, buf + MGMT_HDR_SIZE, len);
+	case MGMT_EV_NEW_LINK_KEY:
+		mgmt_new_link_key(sk, index, buf + MGMT_HDR_SIZE, len);
 		break;
 	case MGMT_EV_DEVICE_CONNECTED:
 		mgmt_device_connected(sk, index, buf + MGMT_HDR_SIZE, len);
@@ -1883,16 +1883,16 @@ static int mgmt_disconnect(int index, bdaddr_t *bdaddr)
 
 static int mgmt_remove_bonding(int index, bdaddr_t *bdaddr)
 {
-	char buf[MGMT_HDR_SIZE + sizeof(struct mgmt_cp_remove_key)];
+	char buf[MGMT_HDR_SIZE + sizeof(struct mgmt_cp_remove_keys)];
 	struct mgmt_hdr *hdr = (void *) buf;
-	struct mgmt_cp_remove_key *cp = (void *) &buf[sizeof(*hdr)];
+	struct mgmt_cp_remove_keys *cp = (void *) &buf[sizeof(*hdr)];
 	char addr[18];
 
 	ba2str(bdaddr, addr);
 	DBG("index %d addr %s", index, addr);
 
 	memset(buf, 0, sizeof(buf));
-	hdr->opcode = htobs(MGMT_OP_REMOVE_KEY);
+	hdr->opcode = htobs(MGMT_OP_REMOVE_KEYS);
 	hdr->len = htobs(sizeof(*cp));
 	hdr->index = htobs(index);
 
@@ -1946,12 +1946,12 @@ static int mgmt_restore_powered(int index)
 	return -ENOSYS;
 }
 
-static int mgmt_load_keys(int index, GSList *keys, gboolean debug_keys)
+static int mgmt_load_link_keys(int index, GSList *keys, gboolean debug_keys)
 {
 	char *buf;
 	struct mgmt_hdr *hdr;
-	struct mgmt_cp_load_keys *cp;
-	struct mgmt_key_info *key;
+	struct mgmt_cp_load_link_keys *cp;
+	struct mgmt_link_key_info *key;
 	size_t key_count, cp_size;
 	GSList *l;
 	int err;
@@ -1969,7 +1969,7 @@ static int mgmt_load_keys(int index, GSList *keys, gboolean debug_keys)
 	memset(buf, 0, sizeof(buf));
 
 	hdr = (void *) buf;
-	hdr->opcode = htobs(MGMT_OP_LOAD_KEYS);
+	hdr->opcode = htobs(MGMT_OP_LOAD_LINK_KEYS);
 	hdr->len = htobs(cp_size);
 	hdr->index = htobs(index);
 
@@ -2148,7 +2148,7 @@ static struct btd_adapter_ops mgmt_ops = {
 	.remove_uuid = mgmt_remove_uuid,
 	.disable_cod_cache = mgmt_disable_cod_cache,
 	.restore_powered = mgmt_restore_powered,
-	.load_keys = mgmt_load_keys,
+	.load_keys = mgmt_load_link_keys,
 	.set_io_capability = mgmt_set_io_capability,
 	.create_bonding = mgmt_create_bonding,
 	.cancel_bonding = mgmt_cancel_bonding,