Skip to contentSkip to conversation

mgmt-api: Update Device Found Event documentation

PATCH Applied Luiz Augusto von Dentz 3 participants 5 messages Jun 20, 2023 – Jun 21, 2023

Subsystems (2)
lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/3 mgmt-api: Update Device Found Event documentation

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

This updates Device Found Event documentation to mention the new flag introduced to track when the event is generated due a interleaved Scan Response that couldn't be merged.

---
 doc/mgmt-api.txt | 1 +
 1 file changed, 1 insertion(+)
doc/mgmt-api.txt +1 -0
index c7191a028238..59e61d361dc2 100644
@@ -4399,6 +4399,7 @@ Device Found Event
 		2	Not Connectable
 		3	Reserved (not in use)
 		4	Name Request Failed
+		5	Scan Response
 
 	For the RSSI field a value of 127 indicates that the RSSI is
 	not available. That can happen with Bluetooth 1.1 and earlier
Signature · 1 line
2.40.1
author maintainer
#1 lore raw

PATCH 2/3 monitor: Add missing flags to MGMT Device Found Event

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

This adds the missing flags to MGMT Device Found Event so they can be decoded properly.

---
 monitor/packet.c | 2 ++
 1 file changed, 2 insertions(+)
monitor/packet.c +2 -0
index 6d73e5abfcbc..4473fda29a46 100644
@@ -12858,6 +12858,8 @@ static const struct bitfield_data mgmt_device_flags_table[] = {
 	{  1, "Legacy Pairing"			},
 	{  2, "Not Connectable"			},
 	{  3, "Connection Locally Initiated"	},
+	{  4, "Name Request Failed"		},
+	{  5, "Scan Response"			},
 	{ }
 };
 
Signature · 1 line
2.40.1
author maintainer
#2 lore raw

PATCH 3/3 adapter: Handle Device Found Event with Scan Response flag

In reply to Luiz Augusto von Dentz

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

This handles recently introduced Scan Response flag since that shouldn't affect connectable flag the device would be considered connectable but it shall not create a new device by itself.

---
 lib/mgmt.h        |  1 +
 src/adapter.c     | 44 +++++++++++++++++++++++++-------------------
 src/adapter.h     |  8 +++-----
 src/adv_monitor.c | 17 +++--------------
 4 files changed, 32 insertions(+), 38 deletions(-)
lib/mgmt.h +1 -0
index c3c9052320bb..062fa027127c 100644
@@ -902,6 +902,7 @@ struct mgmt_ev_auth_failed {
 #define MGMT_DEV_FOUND_NOT_CONNECTABLE		BIT(2)
 #define MGMT_DEV_FOUND_INITIATED_CONN		BIT(3)
 #define MGMT_DEV_FOUND_NAME_REQUEST_FAILED	BIT(4)
+#define MGMT_DEV_FOUND_SCAN_RSP			BIT(5)
 
 #define MGMT_EV_DEVICE_FOUND		0x0012
 struct mgmt_ev_device_found {
src/adapter.c +25 -19

84 lines not on this page · raw message

src/adapter.h +3 -5
index 32e49a933b13..ca96c1f6575f 100644
@@ -88,14 +88,12 @@ struct btd_device *btd_adapter_find_device_by_path(struct btd_adapter *adapter,
 						   const char *path);
 struct btd_device *btd_adapter_find_device_by_fd(int fd);
 
-void btd_adapter_update_found_device(struct btd_adapter *adapter,
+void btd_adapter_device_found(struct btd_adapter *adapter,
 					const bdaddr_t *bdaddr,
 					uint8_t bdaddr_type, int8_t rssi,
-					bool confirm, bool legacy,
-					bool not_connectable,
-					bool name_resolve_failed,
+					uint32_t flags,
 					const uint8_t *data, uint8_t data_len,
-					bool monitored);
+					bool monitoring);
 
 const char *adapter_get_path(struct btd_adapter *adapter);
 const bdaddr_t *btd_adapter_get_address(struct btd_adapter *adapter);
src/adv_monitor.c +3 -14
index 33f4d9619c1c..cb38916fc28b 100644
@@ -1583,10 +1583,6 @@ static void adv_monitor_device_found_callback(uint16_t index, uint16_t length,
 	const uint8_t *ad_data = NULL;
 	uint16_t ad_data_len;
 	uint32_t flags;
-	bool confirm_name;
-	bool legacy;
-	bool not_connectable;
-	bool name_resolve_failed;
 	char addr[18];
 
 	if (length < sizeof(*ev)) {
@@ -1605,21 +1601,14 @@ static void adv_monitor_device_found_callback(uint16_t index, uint16_t length,
 	if (ad_data_len > 0)
 		ad_data = ev->ad_data;
 
-	flags = btohl(ev->flags);
+	flags = le32_to_cpu(ev->flags);
 
 	ba2str(&ev->addr.bdaddr, addr);
 	DBG("hci%u addr %s, rssi %d flags 0x%04x ad_data_len %u",
 			index, addr, ev->rssi, flags, ad_data_len);
 
-	confirm_name = (flags & MGMT_DEV_FOUND_CONFIRM_NAME);
-	legacy = (flags & MGMT_DEV_FOUND_LEGACY_PAIRING);
-	not_connectable = (flags & MGMT_DEV_FOUND_NOT_CONNECTABLE);
-	name_resolve_failed = (flags & MGMT_DEV_FOUND_NAME_REQUEST_FAILED);
-
-	btd_adapter_update_found_device(adapter, &ev->addr.bdaddr,
-					ev->addr.type, ev->rssi, confirm_name,
-					legacy, not_connectable,
-					name_resolve_failed, ad_data,
+	btd_adapter_device_found(adapter, &ev->addr.bdaddr,
+					ev->addr.type, ev->rssi, flags, ad_data,
 					ad_data_len, true);
 
 	if (handle) {
Signature · 1 line
2.40.1
#3 lore raw
In reply to Luiz Augusto von Dentz

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=758865

---Test result---

Test Summary:

CheckPatch                    PASS      1.48 seconds
GitLint                       PASS      1.03 seconds
BuildEll                      PASS      26.57 seconds
BluezMake                     PASS      790.04 seconds
MakeCheck                     PASS      12.17 seconds
MakeDistcheck                 PASS      155.14 seconds
CheckValgrind                 PASS      248.12 seconds
CheckSmatch                   WARNING   335.64 seconds
bluezmakeextell               PASS      101.25 seconds
IncrementalBuild              PASS      1960.96 seconds
ScanBuild                     PASS      1008.06 seconds

Details
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
monitor/packet.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/packet.c:1832:26: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/bt.h:3552:52: warning: array of flexible structuresmonitor/bt.h:3540:40: warning: array of flexible structures

---
Regards,
Linux Bluetooth

#4 lore raw
In reply to Luiz Augusto von Dentz
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 8 lines · On Tue, 20 Jun 2023 13:40:51 -0700 you wrote:

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

This updates Device Found Event documentation to mention the new flag introduced to track when the event is generated due a interleaved Scan Response that couldn't be merged.

---
 doc/mgmt-api.txt | 1 +
 1 file changed, 1 insertion(+)

Here is the summary with links:
- [BlueZ,1/3] mgmt-api: Update Device Found Event documentation

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=98383b917a43
  - [BlueZ,2/3] monitor: Add missing flags to MGMT Device Found Event
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=741a04aba0c3
  - [BlueZ,3/3] adapter: Handle Device Found Event with Scan Response flag
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=c8235156c31b

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html