Diff between 502407f176adc8b42eada956991baebc133ce64d and a83d698f5aa5cdf571ad043d406748c4e9f5a41a

Changed Files

File Additions Deletions Status
emulator/btdev.c +11 -0 modified

Full Patch

diff --git a/emulator/btdev.c b/emulator/btdev.c
index c7231dd..e39b0cc 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -81,6 +81,7 @@ struct btdev {
 	uint16_t acl_max_pkt;
 	uint8_t  country_code;
 	uint8_t  bdaddr[6];
+	uint8_t  random_addr[6];
 	uint8_t  le_features[8];
 	uint8_t  le_states[8];
 
@@ -1493,6 +1494,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode,
 	const struct bt_hci_cmd_write_secure_conn_support *wscs;
 	const struct bt_hci_cmd_set_event_mask_page2 *semp2;
 	const struct bt_hci_cmd_le_set_event_mask *lsem;
+	const struct bt_hci_cmd_le_set_random_address *lsra;
 	const struct bt_hci_cmd_le_set_adv_data *lsad;
 	const struct bt_hci_cmd_setup_sync_conn *ssc;
 	const struct bt_hci_cmd_write_ssp_debug_mode *wsdm;
@@ -2269,6 +2271,15 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode,
 		cmd_complete(btdev, opcode, &lrlf, sizeof(lrlf));
 		break;
 
+	case BT_HCI_CMD_LE_SET_RANDOM_ADDRESS:
+		if (btdev->type == BTDEV_TYPE_BREDR)
+			goto unsupported;
+		lsra = data;
+		memcpy(btdev->random_addr, lsra->addr, 6);
+		status = BT_HCI_ERR_SUCCESS;
+		cmd_complete(btdev, opcode, &status, sizeof(status));
+		break;
+
 	case BT_HCI_CMD_LE_SET_ADV_PARAMETERS:
 		if (btdev->type == BTDEV_TYPE_BREDR)
 			goto unsupported;