Diff between 19b0bc8cfa816d9f441b813ebb1cee50f611b3da and 876d488660c16dccb9992984a709dcd34188f636

Changed Files

File Additions Deletions Status
tools/btmgmt.c +12 -1 modified

Full Patch

diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index 12eabdf..eac7204 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -99,12 +99,23 @@ static bool load_identity(uint16_t index, struct mgmt_irk_info *irk)
 		return false;
 
 	str2ba(addr, &irk->addr.bdaddr);
-	irk->addr.type = type;
 	convert_hexstr(key, irk->val, sizeof(irk->val));
 
 	free(addr);
 	free(key);
 
+	switch (type) {
+	case 0:
+		irk->addr.type = BDADDR_LE_PUBLIC;
+		break;
+	case 1:
+		irk->addr.type = BDADDR_LE_RANDOM;
+		break;
+	default:
+		fprintf(stderr, "Invalid address type %u\n", type);
+		return false;
+	}
+
 	return true;
 }