Device Config Tool

The config command line tool is available to change a device's configuration database. Functions supported include inspect a tree, read values, write values. Import and export whole sections of the tree from and to a file is also supported.

If you run the tool without command line arguments, it generates this:

$ config
Usage:
 
To read a value:
    config get <tree path>
 
To write a value:
    config set <tree path> <new value>
 
To delete a node:
    config delete <tree path>
 
To import config data:
    config import <tree path> <file path>
 
To export config data:
    config export <tree path> <file path>

Where:

  • tree path - Is a path to the tree and node to operate on.
  • file path - Path to the file to import from or export to.
  • new value - Is a string value to write to the config tree.

A tree path is specified similarly to a *nix path.

Paths can be either absolute:

 /a/rooted/path/to/somewhere 

Or relative:

        a/relative/path
        ./another/relative/path
        ../one/more/relative/path

The configTree supports multiple trees, a default tree is provided per user. If the config tool is run as root, then alternative trees can be specified in the path by specifying a tree name, then a colon and the value path.

Here's a sample using a tree named 'foo' instead of the default tree:

        foo:/a/rooted/path/to/somewhere
        foo:a/relative/path
        foo:./another/relative/path
        foo:../one/more/relative/path

The system, or root user, has its own tree, and each application is given a separate tree.

To dump the system tree, run config as:

 config system:/ 

Or run as root:

 config / 

The helloWorld app output would look something like this:

/
  apps/
    helloWorld/
      files/
        0/
          src<string> == /lib/ld-linux.so.3
          dest<string> == /lib/
        1/
          src<string> == /lib/libc.so.6
          dest<string> == /lib/
        2/
          src<string> == /lib/libpthread.so.0
          dest<string> == /lib/
        3/
          src<string> == /lib/librt.so.1
          dest<string> == /lib/
        4/
          src<string> == /usr/local/lib/liblegato.so
          dest<string> == /lib/
        5/
          src<string> == bin/helloWorld
          dest<string> == /bin/
      procs/
        helloWorld/
          args/
            0<string> == helloWorld
          envVars/
            LE_LOG_LEVEL<string> == DEBUG
            PATH<string> == /usr/local/bin:/usr/bin:/bin

No apps installed tree output would look like this:

/
  apps<empty>

The tool can also read and write individual values. When running as root, you can read the src string of file 0 like this:

$ config /apps/helloWorld/files/0/src
/lib/ld-linux.so.3

If you want to see everything for file 0:

$ config /apps/helloWorld/files/0    
0/
  src<string> == /lib/ld-linux.so.3
  dest<string> == /lib/

If you want to change the value of src:

$ config /apps/helloWorld/files/0/src /lib/ld-linux.so.4

You can check it by running:

$ config /apps/helloWorld/files/0/src
/lib/ld-linux.so.4

If the config tool is listing a tree, it tries to advise what kind of node it's writing. It will write <name> and a / to note the given node has children.

In the helloWorld sample, the apps node is written as apps/

When there are no apps installed, you get apps<empty>

For regular values, the config tool will write out the type of the value in addition to its name and value:

/
  testValues/
    aBoolValue<bool> == true
    aStringValue<string> == This is some text I saved.
    anIntValue == 1024
    afloatValue == 10.24

Copyright (C) Sierra Wireless, Inc. 2014. All rights reserved. Use of this work is subject to license.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines