aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri Stolnikov <horiz0n@gmx.net>2014-08-27 21:37:39 +0200
committerDimitri Stolnikov <horiz0n@gmx.net>2014-08-27 21:37:39 +0200
commit8604d76df35dee69c8e5fa7b34c361964418eadb (patch)
treebe44b0e56a46fc1e3df65892b53dbc0aaa227b08
parenta3ee4db0e7e061ac70f207b9a5faeebf835453e1 (diff)
uhd: disable dynamic signature change due to gnuradio bug #719
details: http://gnuradio.org/redmine/issues/719
-rw-r--r--lib/uhd/uhd_sink_c.cc25
-rw-r--r--lib/uhd/uhd_source_c.cc22
2 files changed, 37 insertions, 10 deletions
diff --git a/lib/uhd/uhd_sink_c.cc b/lib/uhd/uhd_sink_c.cc
index f7646d2..f09f437 100644
--- a/lib/uhd/uhd_sink_c.cc
+++ b/lib/uhd/uhd_sink_c.cc
@@ -35,9 +35,23 @@ uhd_sink_c_sptr make_uhd_sink_c(const std::string &args)
return gnuradio::get_initial_sptr(new uhd_sink_c(args));
}
+static size_t parse_nchan(const std::string &args)
+{
+ size_t nchan = 1;
+
+ dict_t dict = params_to_dict(args);
+
+ if (dict.count("nchan"))
+ nchan = boost::lexical_cast< size_t >( dict["nchan"] );
+
+ return nchan;
+}
+
uhd_sink_c::uhd_sink_c(const std::string &args) :
gr::hier_block2("uhd_sink_c",
- gr::io_signature::make(1, 1, sizeof(gr_complex)),
+ gr::io_signature::make(parse_nchan(args),
+ parse_nchan(args),
+ sizeof(gr_complex)),
gr::io_signature::make(0, 0, 0)),
_center_freq(0.0f),
_freq_corr(0.0f),
@@ -92,23 +106,22 @@ uhd_sink_c::uhd_sink_c(const std::string &args) :
_snk = gr::uhd::usrp_sink::make( arguments, stream_args );
- if (dict.count("subdev")) {
+ if (dict.count("subdev"))
_snk->set_subdev_spec( dict["subdev"] );
- }
std::cerr << "-- Using subdev spec '" << _snk->get_subdev_spec() << "'."
<< std::endl;
if (0.0 != _lo_offset)
std::cerr << "-- Using LO offset of " << _lo_offset << " Hz." << std::endl;
-
+#if 0
std::vector<int> sizes = _snk->input_signature()->sizeof_stream_items();
while ( sizes.size() > nchan )
sizes.erase( sizes.end() );
-
+ // TODO: setting the input signature is broken for hier blocks (gnuradio bug #719)
set_input_signature( gr::io_signature::makev( nchan, nchan, sizes ) );
-
+#endif
for ( size_t i = 0; i < nchan; i++ )
connect( self(), i, _snk, i );
}
diff --git a/lib/uhd/uhd_source_c.cc b/lib/uhd/uhd_source_c.cc
index 3fa6000..f800b0d 100644
--- a/lib/uhd/uhd_source_c.cc
+++ b/lib/uhd/uhd_source_c.cc
@@ -36,10 +36,24 @@ uhd_source_c_sptr make_uhd_source_c(const std::string &args)
return gnuradio::get_initial_sptr(new uhd_source_c(args));
}
+static size_t parse_nchan(const std::string &args)
+{
+ size_t nchan = 1;
+
+ dict_t dict = params_to_dict(args);
+
+ if (dict.count("nchan"))
+ nchan = boost::lexical_cast< size_t >( dict["nchan"] );
+
+ return nchan;
+}
+
uhd_source_c::uhd_source_c(const std::string &args) :
gr::hier_block2("uhd_source_c",
gr::io_signature::make(0, 0, 0),
- gr::io_signature::make(1, 1, sizeof(gr_complex))),
+ gr::io_signature::make(parse_nchan(args),
+ parse_nchan(args),
+ sizeof(gr_complex))),
_center_freq(0.0f),
_freq_corr(0.0f),
_lo_offset(0.0f)
@@ -101,14 +115,14 @@ uhd_source_c::uhd_source_c(const std::string &args) :
if (0.0 != _lo_offset)
std::cerr << "-- Using LO offset of " << _lo_offset << " Hz." << std::endl;
-
+#if 0
std::vector<int> sizes = _src->output_signature()->sizeof_stream_items();
while ( sizes.size() > nchan )
sizes.erase( sizes.end() );
-
+ // TODO: setting the output signature is broken for hier blocks (gnuradio bug #719)
set_output_signature( gr::io_signature::makev( nchan, nchan, sizes ) );
-
+#endif
for ( size_t i = 0; i < nchan; i++ )
connect( _src, i, self(), i );
}