[PATCH BlueZ] mesh: Fix to duplicated model Ids saved to storage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



BlueZ internally implements a SIG model for Config Server.

When generating node, if the Mesh Element in mesh application returns modelId 0
among its supported models, it should be skipped, otherwise it will be
duplicated and saved in the storage file.

This patch fixes correctly skipping Config Server model during node creation.
---
 mesh/node.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/mesh/node.c b/mesh/node.c
index e99858623..4e35bb3ff 100644
--- a/mesh/node.c
+++ b/mesh/node.c
@@ -1061,10 +1061,9 @@ static bool validate_model_property(struct node_element *ele,
 		/* Bluetooth SIG defined models */
 		while (l_dbus_message_iter_next_entry(&ids, &mod_id)) {
 			struct mesh_model *mod;
-			uint32_t m = mod_id;
 
 			/* Skip internally implemented models */
-			if (m == CONFIG_SRV_MODEL)
+			if ((VENDOR_ID_MASK | mod_id) == CONFIG_SRV_MODEL)
 				continue;
 
 			mod = l_queue_find(ele->models, match_model_id,
@@ -1078,6 +1077,7 @@ static bool validate_model_property(struct node_element *ele,
 		while (l_dbus_message_iter_next_entry(&ids, &vendor_id,
 								&mod_id)) {
 			struct mesh_model *mod;
+
 			mod = l_queue_find(ele->models, match_model_id,
 				L_UINT_TO_PTR((vendor_id << 16) | mod_id));
 			if (!mod)
@@ -1108,10 +1108,9 @@ static void get_models_from_properties(struct node_element *ele,
 	if (!vendor) {
 		while (l_dbus_message_iter_next_entry(&ids, &mod_id)) {
 			struct mesh_model *mod;
-			uint32_t m = mod_id;
 
 			/* Skip internally implemented models */
-			if (m == CONFIG_SRV_MODEL)
+			if ((VENDOR_ID_MASK | mod_id) == CONFIG_SRV_MODEL)
 				continue;
 
 			mod = mesh_model_new(ele->idx, mod_id);
-- 
2.22.0




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux