tools: Fix missing address type conversion for IRK loading

This commit is contained in:
Marcel Holtmann 2014-12-17 05:45:43 +01:00
parent 19b0bc8cfa
commit 876d488660

View File

@ -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;
}