<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>NumS and NumV fields in Device Composition Data are doubled</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/56327/nums-and-numv-fields-in-device-composition-data-are-doubled</link><description>Using Mesh SDK 3.2.0. 
 The returned Device Composition Data is malformed when requesting it after the node has been reset. This is because the sig_model_count and vendor_model_count for each element is incremented twice for each model. 
 The counter</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 15 Jan 2020 08:39:31 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/56327/nums-and-numv-fields-in-device-composition-data-are-doubled" /><item><title>RE: NumS and NumV fields in Device Composition Data are doubled</title><link>https://devzone.nordicsemi.com/thread/229161?ContentTypeID=1</link><pubDate>Wed, 15 Jan 2020 08:39:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf941655-474f-429a-ae73-57f07179bcd4</guid><dc:creator>JonasJ</dc:creator><description>&lt;p&gt;It&amp;#39;s likely related to this change &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/52156/unable-to-use-mesh-config-stored-data-from-models_init_cb"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/52156/unable-to-use-mesh-config-stored-data-from-models_init_cb&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Anyway, I&amp;#39;m upgrading to 4.0.0 now and this part of the code has been rewritten so there shouldn&amp;#39;t really be any need to dig into this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NumS and NumV fields in Device Composition Data are doubled</title><link>https://devzone.nordicsemi.com/thread/228982?ContentTypeID=1</link><pubDate>Tue, 14 Jan 2020 09:49:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:77a7a09b-b18e-4757-919d-5826e75166d0</guid><dc:creator>JonasJ</dc:creator><description>&lt;p&gt;This will cause problems for apps that actually validate the information sent by the node and simply reject broken messages.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NumS and NumV fields in Device Composition Data are doubled</title><link>https://devzone.nordicsemi.com/thread/228980?ContentTypeID=1</link><pubDate>Tue, 14 Jan 2020 09:49:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:642bf2b0-d2ea-4235-a300-3815b17ffe88</guid><dc:creator>JonasJ</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;FM_ITERATE_ACTION_STOP will be returned if the content on the flash is consider broken, see the comment.&lt;/p&gt;
&lt;p&gt;There is nothing wrong with the flash content thus increment_model_count() is called and FM_ITERATE_ACTION_CONTINUE is returned.&lt;/p&gt;
&lt;p&gt;As I mentioned in the initial report, increment_model_count() is also called in access_model_add(). Thus, the counter is incremented in two places. When the model is added by the application code and when it&amp;#39;s restored from the flash.&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NumS and NumV fields in Device Composition Data are doubled</title><link>https://devzone.nordicsemi.com/thread/228971?ContentTypeID=1</link><pubDate>Tue, 14 Jan 2020 09:39:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f7ba436c-dea2-4dad-a815-26b34fadcfdc</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Does this cause your application to fail at some point? Because it doesn&amp;#39;t do that by default in the examples in SDK3.2.0, as far as I can tell. I don&amp;#39;t know what other changes you did in access.c, but it doesn&amp;#39;t look like restore_acquired_model is being called unless something wrong happens in restore_flash_data().&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;restore_aquired_models should only increment she model count if index &amp;lt; ACCESS_MODEL_COUNT:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static fm_iterate_action_t restore_acquired_model(const fm_entry_t * p_entry, void * p_success)
{
    access_model_state_data_t * p_model_data_entry = (access_model_state_data_t *) p_entry-&amp;gt;data;
    uint16_t index = p_entry-&amp;gt;header.handle &amp;amp; FLASH_HANDLE_TO_ACCESS_HANDLE_MASK;
    if (index &amp;gt;= ACCESS_MODEL_COUNT ||
        p_model_data_entry-&amp;gt;element_index &amp;gt;= ACCESS_ELEMENT_COUNT ||
        (m_model_pool[index].model_info.subscription_pool_index &amp;lt; ACCESS_SUBSCRIPTION_LIST_COUNT &amp;amp;&amp;amp;
         (m_model_pool[index].model_info.subscription_pool_index != p_model_data_entry-&amp;gt;subscription_pool_index ||
          !ACCESS_INTERNAL_STATE_IS_ALLOCATED(m_subscription_list_pool[p_model_data_entry-&amp;gt;subscription_pool_index].internal_state))))
    {
        /* Fail if:
         * - The model handle index is invalid
         * - The element index pointed to is invalid
         * - The model has an allocated subscription list, but the index doesn&amp;#39;t match the one in
         *   flash or isn&amp;#39;t allocated in the subscription list pool
         *
         * All of these conditions are signs that the user access init code has changed (order of
         * allocation etc.)
         */
        *((bool *) p_success) = false;
        return FM_ITERATE_ACTION_STOP;
    }

    if (p_model_data_entry-&amp;gt;subscription_pool_index &amp;lt; ACCESS_SUBSCRIPTION_LIST_COUNT)
    {
        ACCESS_INTERNAL_STATE_RESTORED_SET(m_subscription_list_pool[p_model_data_entry-&amp;gt;subscription_pool_index].internal_state);
    }
    memcpy(&amp;amp;m_model_pool[index].model_info, p_model_data_entry, sizeof(access_model_state_data_t));
    increment_model_count(p_model_data_entry-&amp;gt;element_index, p_model_data_entry-&amp;gt;model_id.company_id);
    return FM_ITERATE_ACTION_CONTINUE;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Because if it returns FM_ITERATE_ACTION_STOP, then&amp;nbsp;restore_flash_data will return 0, and access_models_increment will not be called in restore_acquired_model().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NumS and NumV fields in Device Composition Data are doubled</title><link>https://devzone.nordicsemi.com/thread/228371?ContentTypeID=1</link><pubDate>Thu, 09 Jan 2020 13:40:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:76e20487-1a68-4fe3-b3b0-ddd8b2c99f83</guid><dc:creator>JonasJ</dc:creator><description>&lt;p&gt;Yes, I&amp;#39;m running with some other patches that fixes several issues with DSM and Access. See ticket &lt;a href="https://devzone.nordicsemi.com/support/239135"&gt;https://devzone.nordicsemi.com/support/239135&lt;/a&gt; (Access layer persist data to flash on every boot).&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NumS and NumV fields in Device Composition Data are doubled</title><link>https://devzone.nordicsemi.com/thread/228333?ContentTypeID=1</link><pubDate>Thu, 09 Jan 2020 11:38:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:209e7516-bcfe-43b9-b207-e63872e6ebca</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Thank you for reporting. I have forwarded this to our Mesh team, and I will wait for their reply.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t done any testing with this fix myself, but did you also move the line:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;ACCESS_INTERNAL_STATE_OUTDATED_CLR(m_model_pool[index].internal_state);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>