diff options
author | Tom Tsou <tom.tsou@ettus.com> | 2017-06-15 09:16:53 -0700 |
---|---|---|
committer | Tom Tsou <tom@tsou.cc> | 2017-06-16 17:02:27 +0000 |
commit | 988a464d5d155b1eed0700f971da1e319275d092 (patch) | |
tree | 64586226e9a647f92f2de78a14b8faf7c2f948c3 | |
parent | 1b6ab7d7ee269fe350f91d83562a940877603733 (diff) |
uhd: Fix USRP2/N200/N210 device detection
Commit 1fb0ce67 "uhd: Use map container for for device parameter access"
inadvertently removed the string identifier for the USRP2 and derived
devices (N200/N210).
Add the missing USRP2 string identifier. Also search for partial string
matches in the UHD provided device and mboard stings. This is necessary
to guarantee that strings such as "N200r3" instead of just "N200" are
sucessfully found.
Tested with N200, X310, B200mini and B210 devices.
Change-Id: Ide4e22418e2cc469418cba018970cb0eb9906697
-rw-r--r-- | Transceiver52M/UHDDevice.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Transceiver52M/UHDDevice.cpp b/Transceiver52M/UHDDevice.cpp index 233d465..833f02f 100644 --- a/Transceiver52M/UHDDevice.cpp +++ b/Transceiver52M/UHDDevice.cpp @@ -526,25 +526,25 @@ bool uhd_device::parse_dev_type() { "E3XX", { E3XX, TX_WINDOW_FIXED } }, { "X300", { X3XX, TX_WINDOW_FIXED } }, { "X310", { X3XX, TX_WINDOW_FIXED } }, + { "USRP2", { USRP2, TX_WINDOW_FIXED } }, { "UmTRX", { UMTRX, TX_WINDOW_FIXED } }, { "STREAM", { LIMESDR, TX_WINDOW_USRP1 } }, }; // Compare UHD motherboard and device strings */ - std::string found; - if (devStringMap.find(devString) != devStringMap.end()) - found = devString; - else if (devStringMap.find(mboardString) != devStringMap.end()) - found = mboardString; - - if (found.empty()) { - LOG(ALERT) << "Unsupported device " << devString; - return false; + auto mapIter = devStringMap.begin(); + while (mapIter != devStringMap.end()) { + if (devString.find(mapIter->first) != std::string::npos || + mboardString.find(mapIter->first) != std::string::npos) { + dev_type = std::get<0>(mapIter->second); + tx_window = std::get<1>(mapIter->second); + return true; + } + mapIter++; } - dev_type = devStringMap.at(found).first; - tx_window = devStringMap.at(found).second; - return true; + LOG(ALERT) << "Unsupported device " << devString; + return false; } /* |