diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2012-07-25 13:18:28 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2012-07-25 13:18:28 +0200 |
commit | e5a04ea35dc6f8c0f7f19997f89f6bc96a54d605 (patch) | |
tree | 685121b4f80738946621c84a17a577e891c70822 /src | |
parent | 1c74191ff0c3cd8109ede4d8f3f38da0b34d2286 (diff) |
vty: Document the gsmtap SAPI and the dsp trace flags parameters
Introduce femtobts_tracef_docs with some more information about
the traceflags, add parameters to the vty_cmd_string_from_valstr
for specifying the separator, the suffix and if the name should
be lowered.
Diffstat (limited to 'src')
-rw-r--r-- | src/osmo-bts-sysmo/femtobts.c | 31 | ||||
-rw-r--r-- | src/osmo-bts-sysmo/femtobts.h | 1 | ||||
-rw-r--r-- | src/osmo-bts-sysmo/sysmobts_vty.c | 39 |
3 files changed, 63 insertions, 8 deletions
diff --git a/src/osmo-bts-sysmo/femtobts.c b/src/osmo-bts-sysmo/femtobts.c index 69b33be0..9e0ba085 100644 --- a/src/osmo-bts-sysmo/femtobts.c +++ b/src/osmo-bts-sysmo/femtobts.c @@ -220,6 +220,37 @@ const struct value_string femtobts_tracef_names[29] = { { 0, NULL } }; +const struct value_string femtobts_tracef_docs[29] = { + { DBG_DEBUG, "Debug Region" }, + { DBG_L1WARNING, "L1 Warning Region" }, + { DBG_ERROR, "Error Region" }, + { DBG_L1RXMSG, "L1_RX_MSG Region" }, + { DBG_L1RXMSGBYTE, "L1_RX_MSG_BYTE Region" }, + { DBG_L1TXMSG, "L1_TX_MSG Region" }, + { DBG_L1TXMSGBYTE, "L1_TX_MSG_BYTE Region" }, + { DBG_MPHCNF, "MphConfirmation Region" }, + { DBG_MPHIND, "MphIndication Region" }, + { DBG_MPHREQ, "MphRequest Region" }, + { DBG_PHIND, "PhIndication Region" }, + { DBG_PHREQ, "PhRequest Region" }, + { DBG_PHYRF, "PhyRF Region" }, + { DBG_PHYRFMSGBYTE, "PhyRF Message Region" }, + { DBG_MODE, "Mode Region" }, + { DBG_TDMAINFO, "TDMA Info Region" }, + { DBG_BADCRC, "Bad CRC Region" }, + { DBG_PHINDBYTE, "PH_IND_BYTE" }, + { DBG_PHREQBYTE, "PH_REQ_BYTE" }, + { DBG_DEVICEMSG, "Device Message Region" }, + { DBG_RACHINFO, "RACH Info" }, + { DBG_LOGCHINFO, "LOG_CH_INFO" }, + { DBG_MEMORY, "Memory Region" }, + { DBG_PROFILING, "Profiling Region" }, + { DBG_TESTCOMMENT, "Test Comments" }, + { DBG_TEST, "Test Region" }, + { DBG_STATUS, "Status Region" }, + { 0, NULL } +}; + const struct value_string femtobts_tch_pl_names[] = { { GsmL1_TchPlType_NA, "N/A" }, { GsmL1_TchPlType_Fr, "FR" }, diff --git a/src/osmo-bts-sysmo/femtobts.h b/src/osmo-bts-sysmo/femtobts.h index 5a716ee0..fd5142bc 100644 --- a/src/osmo-bts-sysmo/femtobts.h +++ b/src/osmo-bts-sysmo/femtobts.h @@ -39,6 +39,7 @@ const struct value_string femtobts_l1sapi_names[GsmL1_Sapi_NUM+1]; const struct value_string femtobts_l1status_names[GSML1_STATUS_NUM+1]; const struct value_string femtobts_tracef_names[29]; +const struct value_string femtobts_tracef_docs[29]; const struct value_string femtobts_tch_pl_names[15]; diff --git a/src/osmo-bts-sysmo/sysmobts_vty.c b/src/osmo-bts-sysmo/sysmobts_vty.c index 55292a54..c6b7cd3b 100644 --- a/src/osmo-bts-sysmo/sysmobts_vty.c +++ b/src/osmo-bts-sysmo/sysmobts_vty.c @@ -50,12 +50,15 @@ #define SHOW_TRX_STR \ SHOW_STR \ TRX_STR +#define DSP_TRACE_F_STR "DSP Trace Flag\n" +#define DO_LOWER 1 static struct gsm_bts *vty_bts; /* This generates the logging command string for VTY. */ const char *vty_cmd_string_from_valstr(const struct value_string *vals, - const char *prefix) + const char *prefix, const char *sep, + const char *end, int do_lower) { int len = 0, offset = 0, ret, rem; int size = strlen(prefix); @@ -81,10 +84,11 @@ const char *vty_cmd_string_from_valstr(const struct value_string *vals, char name[name_len]; for (j = 0; j < name_len; j++) - name[j] = tolower(vs->str[j]); + name[j] = do_lower ? + tolower(vs->str[j]) : vs->str[j]; name[name_len-1] = '\0'; - ret = snprintf(str + offset, rem, "%s|", name); + ret = snprintf(str + offset, rem, "%s%s", name, sep); if (ret < 0) goto err; OSMO_SNPRINTF_RET(ret, rem, offset, len); @@ -93,7 +97,7 @@ const char *vty_cmd_string_from_valstr(const struct value_string *vals, offset--; /* to remove the trailing | */ rem++; - ret = snprintf(str + offset, rem, ")"); + ret = snprintf(str + offset, rem, end); if (ret < 0) goto err; OSMO_SNPRINTF_RET(ret, rem, offset, len); @@ -460,13 +464,32 @@ int bts_model_vty_init(struct gsm_bts *bts) /* runtime-patch the command strings with debug levels */ dsp_trace_f_cmd.string = vty_cmd_string_from_valstr(femtobts_tracef_names, - "trx <0-0> dsp-trace-flag ("); + "trx <0-0> dsp-trace-flag (", + "|",")", DO_LOWER); + dsp_trace_f_cmd.doc = vty_cmd_string_from_valstr(femtobts_tracef_docs, + TRX_STR DSP_TRACE_F_STR, + "\n", "", 0); + no_dsp_trace_f_cmd.string = vty_cmd_string_from_valstr(femtobts_tracef_names, - "no trx <0-0> dsp-trace-flag ("); + "no trx <0-0> dsp-trace-flag (", + "|",")", DO_LOWER); + no_dsp_trace_f_cmd.doc = vty_cmd_string_from_valstr(femtobts_tracef_docs, + NO_STR TRX_STR DSP_TRACE_F_STR, + "\n", "", 0); + cfg_trx_gsmtap_sapi_cmd.string = vty_cmd_string_from_valstr(femtobts_l1sapi_names, - "gsmtap-sapi ("); + "gsmtap-sapi (", + "|",")", DO_LOWER); + cfg_trx_gsmtap_sapi_cmd.doc = vty_cmd_string_from_valstr(femtobts_l1sapi_names, + "GSMTAP SAPI\n", + "\n", "", 0); + cfg_trx_no_gsmtap_sapi_cmd.string = vty_cmd_string_from_valstr(femtobts_l1sapi_names, - "no gsmtap-sapi ("); + "no gsmtap-sapi (", + "|",")", DO_LOWER); + cfg_trx_no_gsmtap_sapi_cmd.doc = vty_cmd_string_from_valstr(femtobts_l1sapi_names, + NO_STR "GSMTAP SAPI\n", + "\n", "", 0); install_element_ve(&show_dsp_trace_f_cmd); install_element_ve(&show_sys_info_cmd); |