[PATCH] osmo-trx[master]: uhd: Fix USRP2/N200/N210 device detection

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Tom Tsou gerrit-no-reply at lists.osmocom.org
Thu Jun 15 23:17:45 UTC 2017


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/2925

to look at the new patch set (#2).

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
---
M Transceiver52M/UHDDevice.cpp
1 file changed, 12 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/25/2925/2

diff --git a/Transceiver52M/UHDDevice.cpp b/Transceiver52M/UHDDevice.cpp
index ecf2c34..34a5181 100644
--- a/Transceiver52M/UHDDevice.cpp
+++ b/Transceiver52M/UHDDevice.cpp
@@ -526,25 +526,25 @@
 		{ "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;
 }
 
 /*

-- 
To view, visit https://gerrit.osmocom.org/2925
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ide4e22418e2cc469418cba018970cb0eb9906697
Gerrit-PatchSet: 2
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Tom Tsou <tom at tsou.cc>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list