From 5e01b9eb788e9a4df34405fb24c52a42f9660a0f Mon Sep 17 00:00:00 2001
From: Nick Foster <nick@ettus.com>
Date: Mon, 10 Oct 2011 11:51:29 -0700
Subject: B100/USRP1: pass in VID/PID from args string so you can specify where
 to look for devices if you like

---
 host/lib/usrp/usrp1/usrp1_impl.cpp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

(limited to 'host/lib/usrp/usrp1')

diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp
index dbf7a5092..fe4541d38 100644
--- a/host/lib/usrp/usrp1/usrp1_impl.cpp
+++ b/host/lib/usrp/usrp1/usrp1_impl.cpp
@@ -33,6 +33,7 @@
 #include <boost/filesystem.hpp>
 #include <boost/thread/thread.hpp>
 #include <boost/lexical_cast.hpp>
+#include <cstdio>
 
 using namespace uhd;
 using namespace uhd::usrp;
@@ -61,8 +62,15 @@ static device_addrs_t usrp1_find(const device_addr_t &hint)
     //since an address is intended for a different, non-USB, device.
     if (hint.has_key("addr")) return usrp1_addrs;
 
-    boost::uint16_t vid = hint.has_key("uninit") ? FX2_VENDOR_ID : USRP1_VENDOR_ID;
-    boost::uint16_t pid = hint.has_key("uninit") ? FX2_PRODUCT_ID : USRP1_PRODUCT_ID;
+    unsigned int vid, pid;
+
+    if(hint.has_key("vid") && hint.has_key("pid") && hint.has_key("type") && hint["type"] == "usrp1") {
+        sscanf(hint.get("vid").c_str(), "%x", &vid);
+        sscanf(hint.get("pid").c_str(), "%x", &pid);
+    } else {
+        vid = USRP1_VENDOR_ID;
+        pid = USRP1_PRODUCT_ID;
+    }
 
     // Important note:
     // The get device list calls are nested inside the for loop.
-- 
cgit v1.2.3