From b027ec3bda16182da9b0fab88a8b12fff6209dfc Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Thu, 31 Aug 2017 14:32:50 +0200 Subject: [PATCH] srslte_str2 functions convert to lower or capital letters --- lib/src/phy/common/phy_common.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/src/phy/common/phy_common.c b/lib/src/phy/common/phy_common.c index cfb6d717b..977ebc5b1 100644 --- a/lib/src/phy/common/phy_common.c +++ b/lib/src/phy/common/phy_common.c @@ -125,6 +125,11 @@ bool srslte_N_id_1_isvalid(uint32_t N_id_1) { } srslte_mod_t srslte_str2mod (char * mod_str) { + int i = 0; + + /* Upper case */ + while (mod_str[i] &= (~' '), mod_str[++i]); + if (!strcmp(mod_str, "QPSK")) { return SRSLTE_MOD_QPSK; } else if (!strcmp(mod_str, "16QAM")) { @@ -437,13 +442,18 @@ struct lte_band lte_bands[SRSLTE_NOF_LTE_BANDS] = { int srslte_str2mimotype(char *mimo_type_str, srslte_mimo_type_t *type) { - if (!strcmp(mimo_type_str, "single") || !strcmp(mimo_type_str, "Port0")) { + int i = 0; + + /* Low case */ + while (mimo_type_str[i] |= ' ', mimo_type_str[++i]); + + if (!strcmp(mimo_type_str, "single") || !strcmp(mimo_type_str, "port0")) { *type = SRSLTE_MIMO_TYPE_SINGLE_ANTENNA; - } else if (!strcmp(mimo_type_str, "diversity") || !strcmp(mimo_type_str, "TxDiversity")) { + } else if (!strcmp(mimo_type_str, "diversity") || !strcmp(mimo_type_str, "txdiversity")) { *type = SRSLTE_MIMO_TYPE_TX_DIVERSITY; - } else if (!strcmp(mimo_type_str, "multiplex") || !strcmp(mimo_type_str, "SpatialMux")) { + } else if (!strcmp(mimo_type_str, "multiplex") || !strcmp(mimo_type_str, "spatialmux")) { *type = SRSLTE_MIMO_TYPE_SPATIAL_MULTIPLEX; - } else if (!strcmp(mimo_type_str, "cdd") || !strcmp(mimo_type_str, "CDD")) { + } else if (!strcmp(mimo_type_str, "cdd")) { *type = SRSLTE_MIMO_TYPE_CDD; } else { return SRSLTE_ERROR;