* [PATCH BlueZ] mesh: Fix to duplicated model Ids saved to storage
@ 2019-06-26 15:49 Rafał Gajda
2019-06-26 17:32 ` Gix, Brian
0 siblings, 1 reply; 2+ messages in thread
From: Rafał Gajda @ 2019-06-26 15:49 UTC (permalink / raw)
To: linux-bluetooth
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH BlueZ] mesh: Fix to duplicated model Ids saved to storage
2019-06-26 15:49 [PATCH BlueZ] mesh: Fix to duplicated model Ids saved to storage Rafał Gajda
@ 2019-06-26 17:32 ` Gix, Brian
0 siblings, 0 replies; 2+ messages in thread
From: Gix, Brian @ 2019-06-26 17:32 UTC (permalink / raw)
To: linux-bluetooth, rafal.gajda
Applied with minor commit message change, Thanks
On Wed, 2019-06-26 at 17:49 +0200, Rafał Gajda wrote:
> 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);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-26 17:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-26 15:49 [PATCH BlueZ] mesh: Fix to duplicated model Ids saved to storage Rafał Gajda
2019-06-26 17:32 ` Gix, Brian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).