Config tree and app update


#1

Hello

I wanted to use the config tree to store some minor settings. But to my suprise the settings I save is stored if i reboot the device etc. but not if I update the app . Tried both “update” and “app install” but both delete the my new “leaf”. I guess it is only preserved if I update the hole legato system?
https://docs.legato.io/latest/howToSoftwareUpdate.html

Is this correct and if so why?


#2

Config tree items will be maintained across app updates. If you remove the application, then the config tree for that application is removed. So if you do a remove and then install, then the config tree items will not be available.
What modem and legato version are you seeing this behavior?


#3

Ok that’s good news.
I’m using legato 18.06.4 and WP8548 right now.
Maybe it’s because I use the le_cfg_QuickSetString/Bool?


#4

Tried to commit the transaction without using the “QuickSet” but the leaf and value still goes away when I update the app.

Anyone got it working?


#5

Hi @nilsa

I’ve had this working OK on the WP8548.

Have you got the permissions correct in the app.adef file? You need to make sure that you give yourself read and write permissions to your own config tree too. Something like this:

requires:
{
    configTree:
    {
        [rw] .  // read/write access to my own config tree
    }
}

Note that I’ve sometimes seen the data ‘disappear’ when switching an app between sandboxed and unsandboxed. It appears that an unsandboxed app writes the config into the ‘root’ tree by default.

I got around this by explicitly adding the config tree root (by default appName:/ to each read and write to make sure I was always using the correct tree.

ciao, Dave


#6

Hiya,

I’ve just found this note about the config tree when the app is running as root:

Config Tree API

Note
If your app is running as root then the configuration will get added to the System Tree by default. System utilities also use the Config Tree and store their configurations in the system tree.

ciao, Dave


#7

Okay. I ran this app unsandboxed and I did not add the configTree to my adef…
I could read back my stored settings using “config get /apps/myApp/” but not after an app update.

Will try adding the configTree to my adef.


#8

Ok. Found the problem. :grinning:
From before I was polling the app version with:

le_cfg_QuickGetString("/apps/myApp/version", version, 256, “unknown”);

So I thought my config was to be saved in the same “folder” so I used:

le_cfg_QuickSetBool("/apps/myApp/mySetting",false);

And it worked until an app update…
but saving to:

le_cfg_QuickSetBool(“myApp:/mySetting”,false);

solved my problem, and I can check my settings with:

config get myApp:/

Thanks for the help @davidc :+1: