From e75919bc9e1cb1b5f8f69b5a5aabed9b3a1a53d9 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 1 May 2011 15:42:32 -0700 Subject: usrp2: added the concept of device locking to usrp2/nseries devices Each iface instance can lock itself to a particular device. When the device is locked, it cannot be discovered through find. Locking works by having a lock thread periodically update a register in the firmware that says when the device was last locked. The find routine can determine if a device is locked by checking the difference between the current time and this register. --- host/lib/usrp/usrp2/usrp2_impl.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'host/lib/usrp/usrp2/usrp2_impl.cpp') diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp index 48443bba4..2d1f901d7 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.cpp +++ b/host/lib/usrp/usrp2/usrp2_impl.cpp @@ -115,9 +115,11 @@ static device_addrs_t usrp2_find(const device_addr_t &hint_){ //Attempt to read the name from the EEPROM and perform filtering. //This operation can throw due to compatibility mismatch. try{ - mboard_eeprom_t mb_eeprom = usrp2_iface::make(udp_simple::make_connected( - new_addr["addr"], boost::lexical_cast(USRP2_UDP_CTRL_PORT) - ))->mb_eeprom; + usrp2_iface::sptr iface = usrp2_iface::make(udp_simple::make_connected( + new_addr["addr"], BOOST_STRINGIZE(USRP2_UDP_CTRL_PORT) + )); + if (iface->is_device_locked()) continue; //ignore locked devices + mboard_eeprom_t mb_eeprom = iface->mb_eeprom; new_addr["name"] = mb_eeprom["name"]; new_addr["serial"] = mb_eeprom["serial"]; } -- cgit v1.2.3