libx52/proto_config.html

213 lines
8.5 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libx52: Configuration management</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">libx52
&#160;<span id="projectnumber">0.3.2</span>
</div>
<div id="projectbrief">Saitek X52/X52Pro drivers for Linux/Unix</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="x52d_protocol.html">X52 daemon socket communication protocol</a></li> </ul>
</div>
</div><!-- top -->
<div class="PageDoc"><div class="header">
<div class="headertitle">
<div class="title">Configuration management </div> </div>
</div><!--header-->
<div class="contents">
<div class="toc"><h3>Table of Contents</h3>
<ul><li class="level1"><a href="#autotoc_md20">Load configuration</a><ul><li class="level2"><a href="#autotoc_md21">Load from file</a></li>
<li class="level2"><a href="#autotoc_md22">Reload system configuration</a></li>
</ul>
</li>
<li class="level1"><a href="#autotoc_md23">Save configuration</a><ul><li class="level2"><a href="#autotoc_md24">Dump configuration to file</a></li>
<li class="level2"><a href="#autotoc_md25">Save system configuration</a></li>
</ul>
</li>
<li class="level1"><a href="#autotoc_md26">Retrieve configuration parameter</a></li>
<li class="level1"><a href="#autotoc_md27">Set configuration parameter</a></li>
</ul>
</div>
<div class="textblock"><p>The <code>config</code> commands deal with <b>x52d</b> configuration subsystem, and have the following subcommands.</p>
<h1><a class="anchor" id="autotoc_md20"></a>
Load configuration</h1>
<p>The <code>config load</code> subgroup allows you to load a configuration from a given file (discarding anything that was already in memory), or reload the configuration from the command-line specified configuration file (or default configuration file if no option was given on the command line.)</p>
<h2><a class="anchor" id="autotoc_md21"></a>
Load from file</h2>
<p><b>Arguments</b> </p>
<ul>
<li><code>config</code></li>
<li><code>load</code></li>
<li><em>path-to-file</em> </li>
</ul>
<p><b>Returns</b> </p>
<ul>
<li><code>OK</code></li>
<li><code>config</code></li>
<li><code>load</code></li>
<li><em>path-to-file</em> </li>
</ul>
<p><b>Error</b> </p>
<ul>
<li><code>ERR</code></li>
<li><code>Invalid file '/none' for 'config load' command</code></li>
</ul>
<h2><a class="anchor" id="autotoc_md22"></a>
Reload system configuration</h2>
<p><b>Arguments</b> </p>
<ul>
<li><code>config</code></li>
<li><code>reload</code></li>
</ul>
<p><b>Returns</b> </p>
<ul>
<li><code>OK</code></li>
<li><code>config</code></li>
<li><code>reload</code></li>
</ul>
<h1><a class="anchor" id="autotoc_md23"></a>
Save configuration</h1>
<p>The <code>config save</code> subgroup requests the <b>x52d</b> daemon to save the current state of the configuration to disk. This is either the system configuration file, or may be a user specified configuration file. Note that this will be created with the permissions of the running daemon, which may be running as root.</p>
<h2><a class="anchor" id="autotoc_md24"></a>
Dump configuration to file</h2>
<p><b>Arguments</b> </p>
<ul>
<li><code>config</code></li>
<li><code>dump</code></li>
<li><em>path-to-file</em> </li>
</ul>
<p><b>Returns</b> </p>
<ul>
<li><code>OK</code></li>
<li><code>config</code></li>
<li><code>dump</code></li>
<li><em>path-to-file</em> </li>
</ul>
<p><b>Error</b> </p>
<ul>
<li><code>ERR</code></li>
<li><code>Invalid file '/none' for 'config dump' command</code></li>
</ul>
<h2><a class="anchor" id="autotoc_md25"></a>
Save system configuration</h2>
<p><b>Arguments</b> </p>
<ul>
<li><code>config</code></li>
<li><code>save</code></li>
</ul>
<p><b>Returns</b> </p>
<ul>
<li><code>OK</code></li>
<li><code>config</code></li>
<li><code>save</code></li>
</ul>
<h1><a class="anchor" id="autotoc_md26"></a>
Retrieve configuration parameter</h1>
<p>The <code>config get</code> command requests a specific configuration value, given the section and the key. Refer to <a class="el" href="x52d.html">X52 driver daemon</a> for the section and key names, as these are derived from the base configuration.</p>
<p><b>Arguments</b> </p>
<ul>
<li><code>config</code></li>
<li><code>get</code></li>
<li><em>section</em> </li>
<li><em>key</em> </li>
</ul>
<p><b>Returns</b> </p>
<ul>
<li><code>DATA</code></li>
<li><em>section</em> </li>
<li><em>key</em> </li>
<li><em>value</em> </li>
</ul>
<p><b>Example</b> </p>
<div class="fragment"><div class="line">DATA\0mouse\0enabled\0<span class="keyword">true</span>\0</div>
</div><!-- fragment --><p><b>Error example</b></p>
<div class="fragment"><div class="line">ERR\0Error getting <span class="stringliteral">&#39;foo.bar&#39;</span>\0</div>
</div><!-- fragment --><h1><a class="anchor" id="autotoc_md27"></a>
Set configuration parameter</h1>
<p>The <code>config set</code> command requests the <b>x52d</b> daemon to set the given (section, key) parameter to the given value. The daemon will treat it the same way as if it was being read from the configuration file, i.e., it will follow identical parsing logic, including ignoring unknown keys and not reporting errors for them.</p>
<p>A side effect of this is that the client could request a set for any arbitrary section and key pair, and if that pair was not recognized, it would be ignored, but the daemon would still send an <code>OK</code> response.</p>
<p>This will set the value within the configuration memory structures, and will immediately invoke the relevant callback to update the rest of the threads or device state.</p>
<p><b>Arguments</b> </p>
<ul>
<li><code>config</code></li>
<li><code>set</code></li>
<li><em>section</em> </li>
<li><em>key</em> </li>
<li><em>value</em> </li>
</ul>
<p><b>Returns</b> </p>
<ul>
<li><code>OK</code></li>
<li><code>config</code></li>
<li><code>set</code></li>
<li><em>section</em> </li>
<li><em>key</em> </li>
<li><em>value</em> </li>
</ul>
<p><b>Error example</b></p>
<div class="fragment"><div class="line">ERR\0Error 22 setting <span class="stringliteral">&#39;led.fire&#39;</span>=<span class="stringliteral">&#39;none&#39;</span>: Invalid argument\0</div>
</div><!-- fragment --> </div></div><!-- contents -->
</div><!-- PageDoc -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>