[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:07:58 UTC 2017


Review at  https://gerrit.osmocom.org/2925

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, 10 insertions(+), 4 deletions(-)


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

diff --git a/Transceiver52M/UHDDevice.cpp b/Transceiver52M/UHDDevice.cpp
index ecf2c34..fe084f7 100644
--- a/Transceiver52M/UHDDevice.cpp
+++ b/Transceiver52M/UHDDevice.cpp
@@ -526,16 +526,22 @@
 		{ "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;
+	auto mapIter = devStringMap.begin();
+	while (mapIter != devStringMap.end()) {
+		if (devString.find(mapIter->first) != std::string::npos ||
+		    mboardString.find(mapIter->first) != std::string::npos) {
+			found = mapIter->first;
+			break;
+		}
+		mapIter++;
+	}
 
 	if (found.empty()) {
 		LOG(ALERT) << "Unsupported device " << devString;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ide4e22418e2cc469418cba018970cb0eb9906697
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Tom Tsou <tom at tsou.cc>



More information about the gerrit-log mailing list