Review at  https://gerrit.osmocom.org/2185

config: Remove OpenBTS style sqlite configuration

OpenBTS relies on reading in configuration values from the OpenBTS.config
sqlite3 database. This configuration method is not maintained and not
recommended for Osmocom or OpenBTS use. Command line setup is the
recommended approach.

Note that when the osmo-trx logging mechanism is replaced, the sqlite
dependency will be removed.

Change-Id: I95d7b771fde976818bee76f89163e72c3a44ecdd
---
M Transceiver52M/osmo-trx.cpp
1 file changed, 2 insertions(+), 74 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/85/2185/1

diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp
index 5e81586..e07fd8e 100644
--- a/Transceiver52M/osmo-trx.cpp
+++ b/Transceiver52M/osmo-trx.cpp
@@ -57,8 +57,6 @@
  */
 #define DEFAULT_TRX_PORT       5700
 #define DEFAULT_TRX_IP         "127.0.0.1"
-#define DEFAULT_EXTREF         false
-#define DEFAULT_DIVERSITY      false
 #define DEFAULT_CHANS          1
 
 struct trx_config {
@@ -86,40 +84,6 @@
 
 volatile bool gshutdown = false;
 
-/* Run sanity check on configuration table
- *     The global table constructor cannot provide notification in the
- *     event of failure. Make sure that we can access the database,
- *     write to it, and that it contains the bare minimum required keys.
- */
-bool testConfig()
-{
-       int val = 9999;
-       std::string test = "asldfkjsaldkf";
-       const char *key = "Log.Level";
-
-       /* Attempt to query */
-       try {
-               gConfig.getStr(key);
-       } catch (...) {
-               std::cerr << std::endl;
-               std::cerr << "Config: Failed query required key " << key
-                         << std::endl;
-               return false;
-       }
-
-       /* Attempt to set a test value in the global config */
-       if (!gConfig.set(test, val)) {
-               std::cerr << std::endl;
-               std::cerr << "Config: Failed to set test key" << std::endl;
-               return false;
-       } else {
-               gConfig.remove(test);
-       }
-
-       return true;
-}
-
-
 /* Setup configuration values
  *     Don't query the existence of the Log.Level because it's a
  *     mandatory value. That is, if it doesn't exist, the configuration
@@ -130,43 +94,6 @@
 bool trx_setup_config(struct trx_config *config)
 {
        std::string refstr, fillstr, divstr, mcstr, edgestr;
-
-       if (!testConfig())
-               return false;
-
-       if (config->log_level == "")
-               config->log_level = gConfig.getStr("Log.Level");
-
-       if (!config->port) {
-               if (gConfig.defines("TRX.Port"))
-                       config->port = gConfig.getNum("TRX.Port");
-               else
-                       config->port = DEFAULT_TRX_PORT;
-       }
-
-       if (config->addr == "") {
-               if (gConfig.defines("TRX.IP"))
-                       config->addr = gConfig.getStr("TRX.IP");
-               else
-                       config->addr = DEFAULT_TRX_IP;
-       }
-
-       if (!config->extref) {
-               if (gConfig.defines("TRX.Reference"))
-                       config->extref = gConfig.getNum("TRX.Reference");
-               else
-                       config->extref = DEFAULT_EXTREF;
-       }
-
-       if (!config->diversity) {
-               if (gConfig.defines("TRX.Diversity"))
-                       config->diversity = gConfig.getNum("TRX.Diversity");
-               else
-                       config->diversity = DEFAULT_DIVERSITY;
-       }
-
-       if (!config->chans)
-               config->chans = DEFAULT_CHANS;
 
        if (config->mcbts && ((config->chans < 0) || (config->chans > 5))) {
                std::cout << "Unsupported number of channels" << std::endl;
@@ -350,7 +277,8 @@
 {
        int option;
 
-       config->port = 0;
+       config->addr = DEFAULT_TRX_IP;
+       config->port = DEFAULT_TRX_PORT;
        config->tx_sps = DEFAULT_TX_SPS;
        config->rx_sps = DEFAULT_RX_SPS;
        config->chans = DEFAULT_CHANS;

-- 
To view, visit https://gerrit.osmocom.org/2185
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I95d7b771fde976818bee76f89163e72c3a44ecdd
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Tom Tsou <t...@tsou.cc>

Reply via email to