Diff between 5bb418bbb7ff45fe1db87f59acee30aa7c95ef6e and 9741e4c92d30e71fc878d7fb882b21ed21f85586

Changed Files

File Additions Deletions Status
lib/mgmt.h +1 -1 modified
mgmt/main.c +6 -5 modified
monitor/main.c +6 -4 modified
plugins/mgmtops.c +6 -5 modified

Full Patch

diff --git a/lib/mgmt.h b/lib/mgmt.h
index 59c5c06..f486d1e 100644
--- a/lib/mgmt.h
+++ b/lib/mgmt.h
@@ -388,7 +388,7 @@ struct mgmt_ev_auth_failed {
 struct mgmt_ev_device_found {
 	struct mgmt_addr_info addr;
 	int8_t rssi;
-	uint8_t flags[4];
+	uint32_t flags;
 	uint16_t eir_len;
 	uint8_t eir[0];
 } __packed;
diff --git a/mgmt/main.c b/mgmt/main.c
index b45b075..7e8e2af 100644
--- a/mgmt/main.c
+++ b/mgmt/main.c
@@ -559,6 +559,7 @@ static void confirm_name_rsp(int mgmt_sk, uint16_t op, uint16_t id,
 static int mgmt_device_found(int mgmt_sk, uint16_t index,
 				struct mgmt_ev_device_found *ev, uint16_t len)
 {
+	uint32_t flags;
 	uint16_t eir_len;
 
 	if (len < sizeof(*ev)) {
@@ -567,6 +568,8 @@ static int mgmt_device_found(int mgmt_sk, uint16_t index,
 		return -EINVAL;
 	}
 
+	flags = btohs(ev->flags);
+
 	eir_len = bt_get_le16(&ev->eir_len);
 	if (len != sizeof(*ev) + eir_len) {
 		fprintf(stderr, "dev_found: expected %zu bytes, got %u bytes",
@@ -578,13 +581,11 @@ static int mgmt_device_found(int mgmt_sk, uint16_t index,
 		char addr[18];
 		ba2str(&ev->addr.bdaddr, addr);
 		printf("hci%u dev_found: %s type %s rssi %d "
-			"flags 0x%02x%02x%02x%02x eir_len %u\n", index, addr,
-			typestr(ev->addr.type), ev->rssi,
-			ev->flags[3], ev->flags[2], ev->flags[1], ev->flags[0],
-			eir_len);
+			"flags 0x%04x eir_len %u\n", index, addr,
+			typestr(ev->addr.type), ev->rssi, flags, eir_len);
 	}
 
-	if (discovery && (ev->flags[0] & MGMT_DEV_FOUND_CONFIRM_NAME)) {
+	if (discovery && (flags & MGMT_DEV_FOUND_CONFIRM_NAME)) {
 		struct mgmt_cp_confirm_name cp;
 
 		memset(&cp, 0, sizeof(cp));
diff --git a/monitor/main.c b/monitor/main.c
index 5e08de7..79ed247 100644
--- a/monitor/main.c
+++ b/monitor/main.c
@@ -875,8 +875,8 @@ static void mgmt_user_confirm_request(uint16_t len, void *buf)
 
 	ba2str(&ev->addr.bdaddr, str);
 
-	printf("@ User Confirmation Request: %s (%d) value %d\n",
-					str, ev->addr.type, ev->value);
+	printf("@ User Confirmation Request: %s (%d) hint %d value %d\n",
+			str, ev->addr.type, ev->confirm_hint, ev->value);
 
 	buf += sizeof(*ev);
 	len -= sizeof(*ev);
@@ -928,6 +928,7 @@ static void mgmt_auth_failed(uint16_t len, void *buf)
 static void mgmt_device_found(uint16_t len, void *buf)
 {
 	struct mgmt_ev_device_found *ev = buf;
+	uint32_t flags;
 	char str[18];
 
 	if (len < sizeof(*ev)) {
@@ -935,10 +936,11 @@ static void mgmt_device_found(uint16_t len, void *buf)
 		return;
 	}
 
+	flags = btohs(ev->flags);
 	ba2str(&ev->addr.bdaddr, str);
 
-	printf("@ Device Found: %s (%d) rssi %d\n",
-					str, ev->addr.type, ev->rssi);
+	printf("@ Device Found: %s (%d) rssi %d flags 0x%4.4x\n",
+					str, ev->addr.type, ev->rssi, flags);
 
 	buf += sizeof(*ev);
 	len -= sizeof(*ev);
diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
index 87d3291..25311db 100644
--- a/plugins/mgmtops.c
+++ b/plugins/mgmtops.c
@@ -1344,6 +1344,7 @@ static void mgmt_device_found(int sk, uint16_t index, void *buf, size_t len)
 	struct mgmt_ev_device_found *ev = buf;
 	struct controller_info *info;
 	char addr[18];
+	uint32_t flags;
 	uint16_t eir_len;
 	uint8_t *eir;
 	gboolean confirm_name;
@@ -1372,13 +1373,13 @@ static void mgmt_device_found(int sk, uint16_t index, void *buf, size_t len)
 	else
 		eir = ev->eir;
 
+	flags = btohs(ev->flags);
+
 	ba2str(&ev->addr.bdaddr, addr);
-	DBG("hci%u addr %s, rssi %d flags 0x%02x%02x%02x%02x eir_len %u",
-			index, addr, ev->rssi,
-			ev->flags[3], ev->flags[2], ev->flags[1], ev->flags[0],
-			eir_len);
+	DBG("hci%u addr %s, rssi %d flags 0x%04x eir_len %u",
+			index, addr, ev->rssi, flags, eir_len);
 
-	confirm_name = (ev->flags[0] & MGMT_DEV_FOUND_CONFIRM_NAME);
+	confirm_name = (flags & MGMT_DEV_FOUND_CONFIRM_NAME);
 
 	btd_event_device_found(&info->bdaddr, &ev->addr.bdaddr,
 						addr_type(ev->addr.type),