UHDDevice: catch LookupError/IndexError in set{Rx,Tx}Antenna()
Currently configuring 3 channels in multi-ARFCN mode makes the process crash during the Rx/Tx antenna configuration due to uncaught UHD specific LookupError/IndexError exceptions: terminate called after throwing an instance of 'uhd::index_error' what(): LookupError: IndexError: multi_usrp: TX channel 2 out of range for configured TX frontends Let's catch them and terminate gracefully. Change-Id: If66305f2787c6292375e4bfbd60c1d3d764cffd4 Related: OS#4636
This commit is contained in:
parent
58d80a014e
commit
68d8db4d8c
|
@ -1097,7 +1097,14 @@ bool uhd_device::setRxAntenna(const std::string &ant, size_t chan)
|
|||
return false;
|
||||
}
|
||||
|
||||
avail = usrp_dev->get_rx_antennas(chan);
|
||||
/* UHD may throw a LookupError/IndexError here (see OS#4636) */
|
||||
try {
|
||||
avail = usrp_dev->get_rx_antennas(chan);
|
||||
} catch (const uhd::index_error &e) {
|
||||
LOGC(DDEV, ALERT) << "UHD Error: " << e.what();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (std::find(avail.begin(), avail.end(), ant) == avail.end()) {
|
||||
LOGC(DDEV, ALERT) << "Requested non-existent Rx antenna " << ant << " on channel " << chan;
|
||||
LOGC(DDEV, INFO) << "Available Rx antennas: ";
|
||||
|
@ -1133,7 +1140,14 @@ bool uhd_device::setTxAntenna(const std::string &ant, size_t chan)
|
|||
return false;
|
||||
}
|
||||
|
||||
avail = usrp_dev->get_tx_antennas(chan);
|
||||
/* UHD may throw a LookupError/IndexError here (see OS#4636) */
|
||||
try {
|
||||
avail = usrp_dev->get_tx_antennas(chan);
|
||||
} catch (const uhd::index_error &e) {
|
||||
LOGC(DDEV, ALERT) << "UHD Error: " << e.what();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (std::find(avail.begin(), avail.end(), ant) == avail.end()) {
|
||||
LOGC(DDEV, ALERT) << "Requested non-existent Tx antenna " << ant << " on channel " << chan;
|
||||
LOGC(DDEV, INFO) << "Available Tx antennas: ";
|
||||
|
|
Loading…
Reference in New Issue