All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Device Config Tool

Use the config command line tool to change a device's configuration database. Functions supported include: inspect a tree, read/write values, and import/export enitre tree sections.

The command line argument help generates this:

$ config help
Usage:

To read a value:
  config get <tree path>

To write a value:
  config set <tree path> <new value> [<type>]

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>

To list all config trees:
    config list

Where:
  <tree path>: Path to the tree and node to configure.
  <file path>: Path to the file for import/export.
  <new value>: String value to write to the config tree.
  <type>:      Optional, must be bool, int, float, or string.
               If type is bool, value must be true or false.
               If unspecified, default type is string.

  A tree path is specified similar to a *nix path. With the beginning slash
  being optional.

  For example:\n"

      /a/path/to/somewhere
  or
      a/path/to/somewhere

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

Here's an example using the tree named 'foo' instead of the default tree:

      foo:/a/path/to/somewhere

The trees themselves are stored in the file system at:

/opt/legato/configTree

The configTree cycles through the extensions, .rock, .paper, and .scissors to differentiate between versions of the tree file. The base file name is the same as the tree.

A listing for /opt/legato/configTree where the system tree and the user trees are foo and bar looks like this:

$ ls /opt/legato/configTree/ -l
total 32
-rw------- 1 user user 3456 May 12 11:02 bar.rock
-rw------- 1 user user 3456 May 9 11:04 foo.scissors
-rw------- 1 user user 21037 May 9 11:04 system.paper

The system, or root user, has its own tree; each application has a separate tree.

To dump a tree, run this to get the default tree for the current user:

config get /

Or to get a specific tree:

$ config get foo:/
/
helloWorld/
greeted<bool> == true
ignored<bool> == false

The tool can also read and write individual values. You can read the value of greeted like this:

$ config get /helloWorld/greeted
true

If you want to see everything under helloWorld:

$ config get /helloWorld
helloWorld/
greeted<bool> == true
ignored<bool> == false

If you want to change the value of ignored:

$ config set /helloWorld/ignored true bool

You can check it by running:

$ config get /helloWorld/ignored
true

If the config tool is listing a tree it will display the node name and a / if the current node has children. (Except for the root node, as the root node does not have a name.)

For leaf nodes, the config tool will display the value type in angle brackets, <>, as well as its name and actual value:

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

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