diff --git a/grc/gen_osmosdr_blocks.py b/grc/gen_osmosdr_blocks.py index d55ee47..ab11ed7 100644 --- a/grc/gen_osmosdr_blocks.py +++ b/grc/gen_osmosdr_blocks.py @@ -116,7 +116,7 @@ Examples (some arguments may be optional): fcd=0 rtl=0,rtl_xtal=28.80001e6,tuner_xtal=26e6,buffers=64 ... rtl_tcp=127.0.0.1:1234,psize=16384 - uhd=,serial=...,type=usrp1,mcr=52e6,nchan=2,subdev='\\\\'B:0 A:0\\\\'' ... + uhd,serial=...,type=usrp1,mcr=52e6,nchan=2,subdev='\\\\'B:0 A:0\\\\'' ... osmosdr=0,mcr=64e6,nchan=5 ... file=/path/to/file.ext,freq=428e6,rate=1e6,repeat=true,throttle=true ... diff --git a/lib/osmosdr_device.cc b/lib/osmosdr_device.cc index e0bd458..11d4c0b 100644 --- a/lib/osmosdr_device.cc +++ b/lib/osmosdr_device.cc @@ -89,7 +89,9 @@ std::string device_t::to_string(void) const std::string value = entry.second; if (value.find(" ") != std::string::npos) value = "'" + value + "'"; - ss << ((count++) ? pairs_delim : "") + entry.first + pair_delim + value; + ss << ((count++) ? pairs_delim : "") + entry.first; + if (value.length()) + ss << pair_delim + value; } return ss.str(); } diff --git a/lib/uhd/uhd_source_c.cc b/lib/uhd/uhd_source_c.cc index 9aa46fa..203caf4 100644 --- a/lib/uhd/uhd_source_c.cc +++ b/lib/uhd/uhd_source_c.cc @@ -43,8 +43,6 @@ uhd_source_c::uhd_source_c(const std::string &args) : args_to_io_signature(args)) { size_t nchan = 1; - std::string arguments = args; - dict_t dict = params_to_dict(args); if (dict.count("nchan")) @@ -53,12 +51,13 @@ uhd_source_c::uhd_source_c(const std::string &args) : if (0 == nchan) nchan = 1; - arguments.clear(); // rebuild argument string without uhd= prefix + std::string arguments; // rebuild argument string without internal arguments BOOST_FOREACH( dict_t::value_type &entry, dict ) { - if ( "uhd" == entry.first ) - arguments += entry.second; - else + if ( "uhd" != entry.first && + "nchan" != entry.first && + "subdev" != entry.first ) { arguments += entry.first + "=" + entry.second + ","; + } } _src = uhd_make_usrp_source( arguments, @@ -82,7 +81,7 @@ std::vector< std::string > uhd_source_c::get_devices() uhd::device_addr_t hint; BOOST_FOREACH(const uhd::device_addr_t &dev, uhd::device::find(hint)) { - std::string args = "uhd=," + dev.to_string(); + std::string args = "uhd," + dev.to_string(); std::string label = "Ettus"; @@ -107,7 +106,7 @@ std::vector< std::string > uhd_source_c::get_devices() } //devices.clear(); - //devices.push_back( "uhd=,type=usrp1,label='Ettus USRP'" ); + //devices.push_back( "uhd,type=usrp1,label='Ettus USRP'" ); return devices; }