diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2019-08-26 17:10:27 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2019-08-26 17:13:17 +0200 |
commit | e0010fa425b7b24850f5f9eca258405b08923535 (patch) | |
tree | 3e21ba544d6dfaf83453ec1682dadfce11989133 | |
parent | bfc1d0bed77e2454eb954ff2a0ac4b1458ebf3fd (diff) |
lms: Log available antennas if requested antenna fails
Related: OS#3343
Change-Id: Icd328e85b0a75ef67f371a7ed72638053b1854f9
-rw-r--r-- | Transceiver52M/device/lms/LMSDevice.cpp | 24 | ||||
-rw-r--r-- | Transceiver52M/device/lms/LMSDevice.h | 1 |
2 files changed, 23 insertions, 2 deletions
diff --git a/Transceiver52M/device/lms/LMSDevice.cpp b/Transceiver52M/device/lms/LMSDevice.cpp index f55b555..b7cb31d 100644 --- a/Transceiver52M/device/lms/LMSDevice.cpp +++ b/Transceiver52M/device/lms/LMSDevice.cpp @@ -431,6 +431,20 @@ double LMSDevice::setRxGain(double dB, size_t chan) return dB; } +void LMSDevice::log_ant_list(bool dir_tx, size_t chan, std::ostringstream& os) +{ + lms_name_t name_list[MAX_ANTENNA_LIST_SIZE]; /* large enough list for antenna names. */ + int num_names; + int i; + + num_names = LMS_GetAntennaList(m_lms_dev, dir_tx, chan, name_list); + for (i = 0; i < num_names; i++) { + if (i) + os << ", "; + os << "'" << name_list[i] << "'"; + } +} + int LMSDevice::get_ant_idx(const std::string & name, bool dir_tx, size_t chan) { lms_name_t name_list[MAX_ANTENNA_LIST_SIZE]; /* large enough list for antenna names. */ @@ -484,7 +498,10 @@ bool LMSDevice::setRxAntenna(const std::string & ant, size_t chan) idx = get_ant_idx(ant, LMS_CH_RX, chan); if (idx < 0) { - LOGCHAN(chan, DDEV, ERROR) << "Invalid Rx Antenna"; + std::ostringstream os; + LOGCHAN(chan, DDEV, ERROR) << "Invalid Rx Antenna: " << ant; + log_ant_list(LMS_CH_RX, chan, os); + LOGCHAN(chan, DDEV, NOTICE) << "Available Rx Antennas: " << os; return false; } @@ -530,7 +547,10 @@ bool LMSDevice::setTxAntenna(const std::string & ant, size_t chan) idx = get_ant_idx(ant, LMS_CH_TX, chan); if (idx < 0) { - LOGCHAN(chan, DDEV, ERROR) << "Invalid Rx Antenna"; + std::ostringstream os; + LOGCHAN(chan, DDEV, ERROR) << "Invalid Tx Antenna: " << ant; + log_ant_list(LMS_CH_TX, chan, os); + LOGCHAN(chan, DDEV, NOTICE) << "Available Tx Antennas: " << os; return false; } diff --git a/Transceiver52M/device/lms/LMSDevice.h b/Transceiver52M/device/lms/LMSDevice.h index 47bac94..ab45b08 100644 --- a/Transceiver52M/device/lms/LMSDevice.h +++ b/Transceiver52M/device/lms/LMSDevice.h @@ -63,6 +63,7 @@ private: bool do_calib(size_t chan); bool do_filters(size_t chan); + void log_ant_list(bool dir_tx, size_t chan, std::ostringstream& os); int get_ant_idx(const std::string & name, bool dir_tx, size_t chan); bool flush_recv(size_t num_pkts); void update_stream_stats_rx(size_t chan, bool *overrun); |