aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp
diff options
context:
space:
mode:
authorNick Foster <nick@ettus.com>2011-10-10 11:51:29 -0700
committerJosh Blum <josh@joshknows.com>2011-10-10 15:49:51 -0700
commit5e01b9eb788e9a4df34405fb24c52a42f9660a0f (patch)
tree9a34b59b46443f5fc1c98f1d46cf7d3d35ea48e6 /host/lib/usrp
parentd2a38f7f16dd0eff32069eb376774aac31ef2082 (diff)
downloaduhd-5e01b9eb788e9a4df34405fb24c52a42f9660a0f.tar.gz
uhd-5e01b9eb788e9a4df34405fb24c52a42f9660a0f.tar.bz2
uhd-5e01b9eb788e9a4df34405fb24c52a42f9660a0f.zip
B100/USRP1: pass in VID/PID from args string so you can specify where to look for devices if you like
Diffstat (limited to 'host/lib/usrp')
-rw-r--r--host/lib/usrp/b100/b100_impl.cpp12
-rw-r--r--host/lib/usrp/usrp1/usrp1_impl.cpp12
2 files changed, 20 insertions, 4 deletions
diff --git a/host/lib/usrp/b100/b100_impl.cpp b/host/lib/usrp/b100/b100_impl.cpp
index 6cdd6f280..5e36a19dd 100644
--- a/host/lib/usrp/b100/b100_impl.cpp
+++ b/host/lib/usrp/b100/b100_impl.cpp
@@ -33,6 +33,7 @@
#include <boost/thread/thread.hpp>
#include <boost/lexical_cast.hpp>
#include "b100_regs.hpp"
+#include <cstdio>
using namespace uhd;
using namespace uhd::usrp;
@@ -57,8 +58,15 @@ static device_addrs_t b100_find(const device_addr_t &hint)
//since an address is intended for a different, non-USB, device.
if (hint.has_key("addr")) return b100_addrs;
- boost::uint16_t vid = hint.has_key("uninit") ? FX2_VENDOR_ID : B100_VENDOR_ID;
- boost::uint16_t pid = hint.has_key("uninit") ? FX2_PRODUCT_ID : B100_PRODUCT_ID;
+ unsigned int vid, pid;
+
+ if(hint.has_key("vid") && hint.has_key("pid") && hint.has_key("type") && hint["type"] == "b100") {
+ sscanf(hint.get("vid").c_str(), "%x", &vid);
+ sscanf(hint.get("pid").c_str(), "%x", &pid);
+ } else {
+ vid = B100_VENDOR_ID;
+ pid = B100_PRODUCT_ID;
+ }
// Important note:
// The get device list calls are nested inside the for loop.
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.