Skip to contentSkip to conversation

mgmt-tester: Fix expected manufacturer

PATCH Superseded Luiz Augusto von Dentz 1 participant 2 messages Oct 21, 2021 Bluetooth drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/2 mgmt-tester: Fix expected manufacturer

From: Luiz Augusto von Dentz <[email protected]>

The emulator is now using Linux Foundation manufacturer ID.

---
 tools/mgmt-tester.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/mgmt-tester.c +1 -1
index 8f6549d0b..67c77efe2 100644
@@ -478,7 +478,7 @@ static void test_condition_complete(struct test_data *data)
 		user->test_setup = setup; \
 		user->test_data = data; \
 		user->expected_version = version; \
-		user->expected_manufacturer = 0x003f; \
+		user->expected_manufacturer = 0x05f1; \
 		user->expected_supported_settings = expected_settings; \
 		user->initial_settings = settings; \
 		tester_add_full(name, data, \
Signature · 1 line
2.31.1
author maintainer
#1 lore raw

PATCH 2/2 btdev: Set Local RPA when own_addr_type is 0x03

From: Luiz Augusto von Dentz <[email protected]>

This enables the emulator to properly emulate the generation of a Local RPA so it always set the random_addr when Create Connection sets 0x03 as own_addr_type 0x03:

< HCI Command: LE Extended.. (0x08|0x0043) plen 26

        Filter policy: Accept list is not used (0x00)
        Own address type: Random (0x03)
        Peer address type: Public (0x00)
        Peer address: 00:AA:01:01:00:00 (Intel Corporation)
        Initiating PHYs: 0x01
        Entry 0: LE 1M
          Scan interval: 60.000 msec (0x0060)
          Scan window: 60.000 msec (0x0060)
          Min connection interval: 30.00 msec (0x0018)
          Max connection interval: 50.00 msec (0x0028)
          Connection latency: 0 (0x0000)
          Supervision timeout: 420 msec (0x002a)
          Min connection length: 0.000 msec (0x0000)
          Max connection length: 0.000 msec (0x0000)
Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

      LE Extended Create Connection (0x08|0x0043) ncmd 1
        Status: Success (0x00)
Quoted 1 line

HCI Event: LE Meta Event (0x3e) plen 31

      LE Enhanced Connection Complete (0x0a)
        Status: Success (0x00)
        Handle: 42
        Role: Central (0x00)
        Peer address type: Public (0x00)
        Peer address: 00:AA:01:01:00:00 (Intel Corporation)
        Local resolvable private address: 60:0C:C5:B9:10:5D (Resolvable)
        Peer resolvable private address: 00:00:00:00:00:00 (Non-Resolvable)
        Connection interval: 50.00 msec (0x0028)
        Connection latency: 0 (0x0000)
        Supervision timeout: 420 msec (0x002a)
        Central clock accuracy: 0x00
---
 emulator/btdev.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
emulator/btdev.c +9 -3
index 096ba2da4..a5f468447 100644
@@ -3545,7 +3545,7 @@ static void le_conn_complete(struct btdev *btdev,
 
 		cc.status = status;
 		cc.peer_addr_type = btdev->le_scan_own_addr_type;
-		if (cc.peer_addr_type == 0x01)
+		if (cc.peer_addr_type == 0x01 || cc.peer_addr_type == 0x03)
 			memcpy(cc.peer_addr, btdev->random_addr, 6);
 		else
 			memcpy(cc.peer_addr, btdev->bdaddr, 6);
@@ -5149,7 +5149,7 @@ static void le_ext_conn_complete(struct btdev *btdev,
 
 		ev.status = status;
 		ev.peer_addr_type = btdev->le_scan_own_addr_type;
-		if (ev.peer_addr_type == 0x01)
+		if (ev.peer_addr_type == 0x01 || ev.peer_addr_type == 0x03)
 			memcpy(ev.peer_addr, btdev->random_addr, 6);
 		else
 			memcpy(ev.peer_addr, btdev->bdaddr, 6);
@@ -5178,7 +5178,13 @@ static void le_ext_conn_complete(struct btdev *btdev,
 	memcpy(ev.peer_addr, cmd->peer_addr, 6);
 	ev.role = 0x00;
 
-	memset(ev.local_rpa, 0, sizeof(ev.local_rpa));
+	/* Use random address as Local RPA if Create Connection own_addr_type
+	 * is 0x03 since that expects the controller to generate the RPA.
+	 */
+	if (btdev->le_scan_own_addr_type == 0x03)
+		memcpy(ev.local_rpa, btdev->random_addr, 6);
+	else
+		memset(ev.local_rpa, 0, sizeof(ev.local_rpa));
 
 	le_meta_event(btdev, BT_HCI_EVT_LE_ENHANCED_CONN_COMPLETE, &ev,
 						sizeof(ev));
Signature · 1 line
2.31.1