[MERGED] osmo-trx[master]: osmo-trx: Use VTY cfg structures while still allowing cmd li...

2018-03-06 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: osmo-trx: Use VTY cfg structures while still allowing cmd line 
options
..


osmo-trx: Use VTY cfg structures while still allowing cmd line options

Existing cmd line options are kept for a while to give people some time
to move to use VTY cfg. All new cfg options should be set only through
VTY. VTY options take preference (override) over cmd line options.
Deprecated options are removed from help message to dissuade users from
keep using them.

Steps to drop cmd line options in the future:
- Drop comma_delimited_to_vector, print_deprecated
- Drop all options in handle_options marked with print_deprecated.
- Set "-c" param to do the same as "-C", to keep compatibility with old
param and still use same naming as all other osmocom projects.
- Remove the hack in main() to set 1 channel implicitly by default.

Change-Id: Ib8de1a5da4b3c0b6a49e00033f616e1d66656adf
---
M Transceiver52M/osmo-trx.cpp
1 file changed, 187 insertions(+), 269 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp
index 7bc025f..f975500 100644
--- a/Transceiver52M/osmo-trx.cpp
+++ b/Transceiver52M/osmo-trx.cpp
@@ -55,52 +55,11 @@
 #include "debug.h"
 }
 
-/* Samples-per-symbol for downlink path
- * 4 - Uses precision modulator (more computation, less distortion)
- * 1 - Uses minimized modulator (less computation, more distortion)
- *
- * Other values are invalid. Receive path (uplink) is always
- * downsampled to 1 sps. Default to 4 sps for all cases.
- */
-#define DEFAULT_TX_SPS 4
-
-/*
- * Samples-per-symbol for uplink (receiver) path
- * Do not modify this value. EDGE configures 4 sps automatically on
- * B200/B210 devices only. Use of 4 sps on the receive path for other
- * configurations is not supported.
- */
-#define DEFAULT_RX_SPS 1
-
-/* Default configuration parameters */
-#define DEFAULT_TRX_PORT   5700
-#define DEFAULT_TRX_IP "127.0.0.1"
-#define DEFAULT_CHANS  1
 #define DEFAULT_CONFIG_FILE"osmo-trx.cfg"
 
-struct trx_config {
-   std::string local_addr;
-   std::string remote_addr;
-   std::string dev_args;
-   char* config_file;
-   unsigned port;
-   unsigned tx_sps;
-   unsigned rx_sps;
-   unsigned chans;
-   unsigned rtsc;
-   unsigned rach_delay;
-   bool extref;
-   bool gpsref;
-   FillerType filler;
-   bool mcbts;
-   double offset;
-   double rssi_offset;
-   bool swap_channels;
-   bool edge;
-   int sched_rr;
-   std::vector rx_paths;
-   std::vector tx_paths;
-};
+#define charp2str(a) ((a) ? std::string(a) : std::string(""))
+
+static char* config_file = (char*)DEFAULT_CONFIG_FILE;
 
 volatile bool gshutdown = false;
 
@@ -112,80 +71,6 @@
 static RadioInterface *radio;
 static Transceiver *transceiver;
 
-/* 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
- * table will crash or will have already crashed. Everything else we
- * can survive without and use default values if the database entries
- * are empty.
- */
-bool trx_setup_config(struct trx_config *config)
-{
-   std::string refstr, fillstr, divstr, mcstr, edgestr;
-   std::vector::const_iterator si;
-
-   if (config->mcbts && config->chans > 5) {
-   std::cout << "Unsupported number of channels" << std::endl;
-   return false;
-   }
-
-   edgestr = config->edge ? "Enabled" : "Disabled";
-   mcstr = config->mcbts ? "Enabled" : "Disabled";
-
-   if (config->extref)
-   refstr = "External";
-   else if (config->gpsref)
-   refstr = "GPS";
-   else
-   refstr = "Internal";
-
-   switch (config->filler) {
-   case FILLER_DUMMY:
-   fillstr = "Dummy bursts";
-   break;
-   case FILLER_ZERO:
-   fillstr = "Disabled";
-   break;
-   case FILLER_NORM_RAND:
-   fillstr = "Normal busrts with random payload";
-   break;
-   case FILLER_EDGE_RAND:
-   fillstr = "EDGE busrts with random payload";
-   break;
-   case FILLER_ACCESS_RAND:
-   fillstr = "Access busrts with random payload";
-   break;
-   }
-
-   std::ostringstream ost("");
-   ost << "Config Settings" << std::endl;
-   ost << "   Device args. " << config->dev_args << std::endl;
-   ost << "   TRX Base Port... " << config->port << std::endl;
-   ost << "   TRX Address. " << config->local_addr << 
std::endl;
-   ost << "   GSM Core Address." << config->remote_addr << 

osmo-trx[master]: osmo-trx: Use VTY cfg structures while still allowing cmd li...

2018-03-06 Thread Pau Espin Pedrol

Patch Set 6:

Manual submitted in https://gerrit.osmocom.org/#/c/7139/

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib8de1a5da4b3c0b6a49e00033f616e1d66656adf
Gerrit-PatchSet: 6
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


osmo-trx[master]: osmo-trx: Use VTY cfg structures while still allowing cmd li...

2018-03-05 Thread Harald Welte

Patch Set 6:

While you're at it, it would be the perfect opportunity now to create a 
osmo-trx-usermanual and osmo-trx-vty-reference in osmo-gsm-manuals.git even 
with only minimal content to help users with a manual as they convert their 
setups

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib8de1a5da4b3c0b6a49e00033f616e1d66656adf
Gerrit-PatchSet: 6
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


osmo-trx[master]: osmo-trx: Use VTY cfg structures while still allowing cmd li...

2018-03-05 Thread Harald Welte

Patch Set 6: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib8de1a5da4b3c0b6a49e00033f616e1d66656adf
Gerrit-PatchSet: 6
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


[PATCH] osmo-trx[master]: osmo-trx: Use VTY cfg structures while still allowing cmd li...

2018-03-05 Thread Pau Espin Pedrol
Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

https://gerrit.osmocom.org/6651

to look at the new patch set (#6).

osmo-trx: Use VTY cfg structures while still allowing cmd line options

Existing cmd line options are kept for a while to give people some time
to move to use VTY cfg. All new cfg options should be set only through
VTY. VTY options take preference (override) over cmd line options.
Deprecated options are removed from help message to dissuade users from
keep using them.

Steps to drop cmd line options in the future:
- Drop comma_delimited_to_vector, print_deprecated
- Drop all options in handle_options marked with print_deprecated.
- Set "-c" param to do the same as "-C", to keep compatibility with old
param and still use same naming as all other osmocom projects.
- Remove the hack in main() to set 1 channel implicitly by default.

Change-Id: Ib8de1a5da4b3c0b6a49e00033f616e1d66656adf
---
M Transceiver52M/osmo-trx.cpp
1 file changed, 187 insertions(+), 269 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/51/6651/6

diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp
index 7bc025f..f975500 100644
--- a/Transceiver52M/osmo-trx.cpp
+++ b/Transceiver52M/osmo-trx.cpp
@@ -55,52 +55,11 @@
 #include "debug.h"
 }
 
-/* Samples-per-symbol for downlink path
- * 4 - Uses precision modulator (more computation, less distortion)
- * 1 - Uses minimized modulator (less computation, more distortion)
- *
- * Other values are invalid. Receive path (uplink) is always
- * downsampled to 1 sps. Default to 4 sps for all cases.
- */
-#define DEFAULT_TX_SPS 4
-
-/*
- * Samples-per-symbol for uplink (receiver) path
- * Do not modify this value. EDGE configures 4 sps automatically on
- * B200/B210 devices only. Use of 4 sps on the receive path for other
- * configurations is not supported.
- */
-#define DEFAULT_RX_SPS 1
-
-/* Default configuration parameters */
-#define DEFAULT_TRX_PORT   5700
-#define DEFAULT_TRX_IP "127.0.0.1"
-#define DEFAULT_CHANS  1
 #define DEFAULT_CONFIG_FILE"osmo-trx.cfg"
 
-struct trx_config {
-   std::string local_addr;
-   std::string remote_addr;
-   std::string dev_args;
-   char* config_file;
-   unsigned port;
-   unsigned tx_sps;
-   unsigned rx_sps;
-   unsigned chans;
-   unsigned rtsc;
-   unsigned rach_delay;
-   bool extref;
-   bool gpsref;
-   FillerType filler;
-   bool mcbts;
-   double offset;
-   double rssi_offset;
-   bool swap_channels;
-   bool edge;
-   int sched_rr;
-   std::vector rx_paths;
-   std::vector tx_paths;
-};
+#define charp2str(a) ((a) ? std::string(a) : std::string(""))
+
+static char* config_file = (char*)DEFAULT_CONFIG_FILE;
 
 volatile bool gshutdown = false;
 
@@ -112,80 +71,6 @@
 static RadioInterface *radio;
 static Transceiver *transceiver;
 
-/* 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
- * table will crash or will have already crashed. Everything else we
- * can survive without and use default values if the database entries
- * are empty.
- */
-bool trx_setup_config(struct trx_config *config)
-{
-   std::string refstr, fillstr, divstr, mcstr, edgestr;
-   std::vector::const_iterator si;
-
-   if (config->mcbts && config->chans > 5) {
-   std::cout << "Unsupported number of channels" << std::endl;
-   return false;
-   }
-
-   edgestr = config->edge ? "Enabled" : "Disabled";
-   mcstr = config->mcbts ? "Enabled" : "Disabled";
-
-   if (config->extref)
-   refstr = "External";
-   else if (config->gpsref)
-   refstr = "GPS";
-   else
-   refstr = "Internal";
-
-   switch (config->filler) {
-   case FILLER_DUMMY:
-   fillstr = "Dummy bursts";
-   break;
-   case FILLER_ZERO:
-   fillstr = "Disabled";
-   break;
-   case FILLER_NORM_RAND:
-   fillstr = "Normal busrts with random payload";
-   break;
-   case FILLER_EDGE_RAND:
-   fillstr = "EDGE busrts with random payload";
-   break;
-   case FILLER_ACCESS_RAND:
-   fillstr = "Access busrts with random payload";
-   break;
-   }
-
-   std::ostringstream ost("");
-   ost << "Config Settings" << std::endl;
-   ost << "   Device args. " << config->dev_args << std::endl;
-   ost << "   TRX Base Port... " << config->port << std::endl;
-   ost << "   TRX Address. " << config->local_addr << 
std::endl;
-   ost << "   GSM Core Address." << config->remote_addr << 
std::endl;
-   ost << "   Channels " << config->chans <<