diff options
-rwxr-xr-x | cmake/Packaging/preinst.in | 2 | ||||
-rw-r--r-- | gnuradio-core/src/lib/io/gr_wavfile_sink.h | 6 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_buffer.h | 3 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc | 23 | ||||
-rwxr-xr-x | gnuradio-examples/python/volk_benchmark/volk_math.py | 17 | ||||
-rw-r--r-- | gr-digital/examples/narrowband/receive_path.py | 12 | ||||
-rw-r--r-- | gr-uhd/include/gr_uhd_usrp_sink.h | 13 | ||||
-rw-r--r-- | gr-uhd/include/gr_uhd_usrp_source.h | 31 | ||||
-rw-r--r-- | gr-uhd/lib/CMakeLists.txt | 3 | ||||
-rw-r--r-- | gr-uhd/lib/Makefile.am | 5 | ||||
-rw-r--r-- | gr-uhd/lib/gr_uhd_amsg_source.cc | 4 | ||||
-rw-r--r-- | gr-uhd/lib/gr_uhd_common.h | 42 | ||||
-rw-r--r-- | gr-uhd/lib/gr_uhd_usrp_sink.cc | 28 | ||||
-rw-r--r-- | gr-uhd/lib/gr_uhd_usrp_source.cc | 65 | ||||
-rw-r--r-- | gr-uhd/swig/__init__.py | 4 |
15 files changed, 225 insertions, 33 deletions
diff --git a/cmake/Packaging/preinst.in b/cmake/Packaging/preinst.in index c60d46568..cb7ee1bc4 100755 --- a/cmake/Packaging/preinst.in +++ b/cmake/Packaging/preinst.in @@ -1,5 +1,5 @@ #!/bin/sh if [ "$1" = "install" ]; then - ls + echo fi diff --git a/gnuradio-core/src/lib/io/gr_wavfile_sink.h b/gnuradio-core/src/lib/io/gr_wavfile_sink.h index 5fd3eaadc..348f789ae 100644 --- a/gnuradio-core/src/lib/io/gr_wavfile_sink.h +++ b/gnuradio-core/src/lib/io/gr_wavfile_sink.h @@ -44,10 +44,10 @@ gr_make_wavfile_sink (const char *filename, int bits_per_sample = 16); /*! - * \brief Read stream from a Microsoft PCM (.wav) file, output floats + * \brief Write stream to a Microsoft PCM (.wav) file. * - * Values are within [-1;1]. - * Check gr_make_wavfile_source() for extra info. + * Values must be floats within [-1;1]. + * Check gr_make_wavfile_sink() for extra info. * * \ingroup sink_blk */ diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h index e8e393756..9478e1ce0 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.h +++ b/gnuradio-core/src/lib/runtime/gr_buffer.h @@ -93,6 +93,7 @@ class GR_CORE_API gr_buffer { uint64_t nitems_written() { return d_abs_write_offset; } + size_t get_sizeof_item() { return d_sizeof_item; } /*! * \brief Adds a new tag to the buffer. @@ -249,6 +250,8 @@ class GR_CORE_API gr_buffer_reader { uint64_t nitems_read() { return d_abs_read_offset; } + size_t get_sizeof_item() { return d_buffer->get_sizeof_item(); } + /*! * \brief Return the block that reads via this reader. * diff --git a/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc b/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc index 5d1057e0f..e97fa13a4 100644 --- a/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc +++ b/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc @@ -28,6 +28,7 @@ #include <gr_block_detail.h> #include <gr_io_signature.h> #include <gr_buffer.h> +#include <volk/volk.h> #include <iostream> #include <map> @@ -243,6 +244,28 @@ gr_flat_flowgraph::merge_connections(gr_flat_flowgraph_sptr old_ffg) if (GR_FLAT_FLOWGRAPH_DEBUG) std::cout << "new block" << std::endl; connect_block_inputs(block); + + const int alignment = volk_get_alignment(); + for(int i = 0; i < block->detail()->ninputs(); i++) { + void *r = (void*)block->detail()->input(i)->read_pointer(); + unsigned long int ri = (unsigned long int)r % alignment; + if(ri != 0) { + size_t itemsize = block->detail()->input(i)->get_sizeof_item(); + block->detail()->input(i)->update_read_pointer(ri/itemsize); + block->set_unaligned(0); + block->set_is_unaligned(false); + } + } + for(int i = 0; i < block->detail()->noutputs(); i++) { + void *w = (void*)block->detail()->output(i)->write_pointer(); + unsigned long int wi = (unsigned long int)w % alignment; + if(wi != 0) { + size_t itemsize = block->detail()->output(i)->get_sizeof_item(); + block->detail()->output(i)->update_write_pointer(wi/itemsize); + block->set_unaligned(0); + block->set_is_unaligned(false); + } + } } // Now deal with the fact that the block details might have changed numbers of diff --git a/gnuradio-examples/python/volk_benchmark/volk_math.py b/gnuradio-examples/python/volk_benchmark/volk_math.py index 8b0081387..8bf9ed6f3 100755 --- a/gnuradio-examples/python/volk_benchmark/volk_math.py +++ b/gnuradio-examples/python/volk_benchmark/volk_math.py @@ -21,7 +21,7 @@ def multiply_const_ff(N): ###################################################################### def multiply_cc(N): - op = gr.multiply_cc() + op = gr.multiply_cc(1) tb = helper(N, op, gr.sizeof_gr_complex, gr.sizeof_gr_complex, 2, 1) return tb @@ -134,16 +134,15 @@ def main(): conn = create_connection(args.database) new_table(conn, label) - if not args.all: - func = avail_tests[args.test] - res = run_tests(func, N, iters) + if args.all: + tests = xrange(len(avail_tests)) + else: + tests = args.tests + + for test in tests: + res = run_tests(avail_tests[test], N, iters) if res is not None: replace_results(conn, label, N, iters, res) - else: - for f in avail_tests: - res = run_tests(f, N, iters) - if res is not None: - replace_results(conn, label, N, iters, res) if __name__ == "__main__": try: diff --git a/gr-digital/examples/narrowband/receive_path.py b/gr-digital/examples/narrowband/receive_path.py index 1c5e58963..1f9310506 100644 --- a/gr-digital/examples/narrowband/receive_path.py +++ b/gr-digital/examples/narrowband/receive_path.py @@ -45,17 +45,25 @@ class receive_path(gr.hier_block2): self._rx_callback = rx_callback # this callback is fired when a packet arrives self._demod_class = demod_class # the demodulator_class we're using + self._chbw_factor = options.chbw_factor # channel filter bandwidth factor + # Get demod_kwargs demod_kwargs = self._demod_class.extract_kwargs_from_options(options) # Build the demodulator self.demodulator = self._demod_class(**demod_kwargs) + + # Make sure the channel BW factor is between 1 and sps/2 + # or the filter won't work. + if(self._chbw_factor < 1.0 or self._chbw_factor > self.samples_per_symbol()/2): + sys.stderr.write("Channel bandwidth factor ({0}) must be within the range [1.0, {1}].\n".format(self._chbw_factor, self.samples_per_symbol()/2)) + sys.exit(1) # Design filter to get actual channel we want sw_decim = 1 chan_coeffs = gr.firdes.low_pass (1.0, # gain sw_decim * self.samples_per_symbol(), # sampling rate - 1.0, # midpoint of trans. band + self._chbw_factor, # midpoint of trans. band 0.5, # width of trans. band gr.firdes.WIN_HANN) # filter type self.channel_filter = gr.fft_filter_ccc(sw_decim, chan_coeffs) @@ -129,6 +137,8 @@ class receive_path(gr.hier_block2): help="set samples/symbol [default=%default]") expert.add_option("", "--log", action="store_true", default=False, help="Log all parts of flow graph to files (CAUTION: lots of data)") + expert.add_option("", "--chbw-factor", type="float", default=1.0, + help="Channel bandwidth = chbw_factor x signal bandwidth [defaut=%default]") # Make a static method to call before instantiation add_options = staticmethod(add_options) diff --git a/gr-uhd/include/gr_uhd_usrp_sink.h b/gr-uhd/include/gr_uhd_usrp_sink.h index d6cbe2fdc..ff4856f9b 100644 --- a/gr-uhd/include/gr_uhd_usrp_sink.h +++ b/gr-uhd/include/gr_uhd_usrp_sink.h @@ -118,6 +118,19 @@ class GR_UHD_API uhd_usrp_sink : virtual public gr_sync_block{ public: /*! + * Set the start time for outgoing samples. + * To control when samples are transmitted, + * set this value before starting the flow graph. + * The value is cleared after each run. + * When not specified, the start time will be: + * - Immediately for the one channel case + * - in the near future for multi-channel + * + * \param time the absolute time for transmission to begin + */ + virtual void set_start_time(const uhd::time_spec_t &time) = 0; + + /*! * Set the frontend specification. * \param spec the subdev spec markup string * \param mboard the motherboard index 0 to M-1 diff --git a/gr-uhd/include/gr_uhd_usrp_source.h b/gr-uhd/include/gr_uhd_usrp_source.h index cf2186bc0..415503bc1 100644 --- a/gr-uhd/include/gr_uhd_usrp_source.h +++ b/gr-uhd/include/gr_uhd_usrp_source.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2011 Free Software Foundation, Inc. + * Copyright 2010-2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -110,6 +110,19 @@ class GR_UHD_API uhd_usrp_source : virtual public gr_sync_block{ public: /*! + * Set the start time for incoming samples. + * To control when samples are received, + * set this value before starting the flow graph. + * The value is cleared after each run. + * When not specified, the start time will be: + * - Immediately for the one channel case + * - in the near future for multi-channel + * + * \param time the absolute time for reception to begin + */ + virtual void set_start_time(const uhd::time_spec_t &time) = 0; + + /*! * Set the frontend specification. * \param spec the subdev spec markup string * \param mboard the motherboard index 0 to M-1 @@ -263,7 +276,7 @@ public: * \param enb true to enable automatic DC offset correction * \param chan the channel index 0 to N-1 */ - virtual void set_dc_offset(const bool enb, size_t chan = 0) = 0; + virtual void set_auto_dc_offset(const bool enb, size_t chan = 0) = 0; /*! * Set a constant DC offset value. @@ -469,10 +482,22 @@ public: * Convenience function for finite data acquisition. * This is not to be used with the scheduler; rather, * one can request samples from the USRP in python. - * //TODO multi-channel * //TODO assumes fc32 + * \param nsamps the number of samples + * \return a vector of complex float samples */ virtual std::vector<std::complex<float> > finite_acquisition(const size_t nsamps) = 0; + + /*! + * Convenience function for finite data acquisition. + * This is the multi-channel version of finite_acquisition; + * This is not to be used with the scheduler; rather, + * one can request samples from the USRP in python. + * //TODO assumes fc32 + * \param nsamps the number of samples per channel + * \return a vector of buffers, where each buffer represents a channel + */ + virtual std::vector<std::vector<std::complex<float> > > finite_acquisition_v(const size_t nsamps) = 0; }; #endif /* INCLUDED_GR_UHD_USRP_SOURCE_H */ diff --git a/gr-uhd/lib/CMakeLists.txt b/gr-uhd/lib/CMakeLists.txt index 432ed1ab6..1f44b0630 100644 --- a/gr-uhd/lib/CMakeLists.txt +++ b/gr-uhd/lib/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011-2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,6 +23,7 @@ include_directories( ${GNURADIO_CORE_INCLUDE_DIRS} ${GR_UHD_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR} ) include_directories(${UHD_INCLUDE_DIRS}) diff --git a/gr-uhd/lib/Makefile.am b/gr-uhd/lib/Makefile.am index c322c6124..41ce79d87 100644 --- a/gr-uhd/lib/Makefile.am +++ b/gr-uhd/lib/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2010-2011 Free Software Foundation, Inc. +# Copyright 2010-2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -25,6 +25,7 @@ AM_CPPFLAGS = \ $(STD_DEFINES_AND_INCLUDES) \ $(WITH_INCLUDES) \ $(UHD_CPPFLAGS) \ + -I$(srcdir) \ -Dgnuradio_uhd_EXPORTS lib_LTLIBRARIES = libgnuradio-uhd.la @@ -40,4 +41,4 @@ libgnuradio_uhd_la_LIBADD = \ libgnuradio_uhd_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS) -noinst_HEADERS = +noinst_HEADERS = gr_uhd_common.h diff --git a/gr-uhd/lib/gr_uhd_amsg_source.cc b/gr-uhd/lib/gr_uhd_amsg_source.cc index 08941584b..67e402f6b 100644 --- a/gr-uhd/lib/gr_uhd_amsg_source.cc +++ b/gr-uhd/lib/gr_uhd_amsg_source.cc @@ -1,5 +1,5 @@ /* - * Copyright 2011 Free Software Foundation, Inc. + * Copyright 2011-2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -22,6 +22,7 @@ #include <gr_uhd_amsg_source.h> #include <boost/bind.hpp> #include <gruel/thread.h> +#include "gr_uhd_common.h" /*********************************************************************** * UHD Asynchronous Message Source Impl @@ -87,6 +88,7 @@ boost::shared_ptr<uhd_amsg_source> uhd_make_amsg_source( const uhd::device_addr_t &device_addr, gr_msg_queue_sptr msgq ){ + gr_uhd_check_abi(); return boost::shared_ptr<uhd_amsg_source>( new uhd_amsg_source_impl(device_addr, msgq) ); diff --git a/gr-uhd/lib/gr_uhd_common.h b/gr-uhd/lib/gr_uhd_common.h new file mode 100644 index 000000000..940f17692 --- /dev/null +++ b/gr-uhd/lib/gr_uhd_common.h @@ -0,0 +1,42 @@ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_UHD_COMMON_H +#define INCLUDED_GR_UHD_COMMON_H + +#include <uhd/version.hpp> +#include <boost/format.hpp> +#include <stdexcept> + +static inline void gr_uhd_check_abi(void){ + #ifdef UHD_VERSION_ABI_STRING + if (std::string(UHD_VERSION_ABI_STRING) == uhd::get_abi_string()) return; + throw std::runtime_error(str(boost::format( + "\nGR-UHD detected ABI compatibility mismatch with UHD library.\n" + "GR-UHD was build against ABI: %s,\n" + "but UHD library reports ABI: %s\n" + "Suggestion: install an ABI compatible version of UHD,\n" + "or rebuild GR-UHD component against this ABI version.\n" + ) % UHD_VERSION_ABI_STRING % uhd::get_abi_string())); + #endif +} + +#endif /* INCLUDED_GR_UHD_COMMON_H */ diff --git a/gr-uhd/lib/gr_uhd_usrp_sink.cc b/gr-uhd/lib/gr_uhd_usrp_sink.cc index 7d173d972..7e7875898 100644 --- a/gr-uhd/lib/gr_uhd_usrp_sink.cc +++ b/gr-uhd/lib/gr_uhd_usrp_sink.cc @@ -1,5 +1,5 @@ /* - * Copyright 2010-2011 Free Software Foundation, Inc. + * Copyright 2010-2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,6 +23,7 @@ #include <gr_io_signature.h> #include <stdexcept> #include <boost/make_shared.hpp> +#include "gr_uhd_common.h" static const pmt::pmt_t SOB_KEY = pmt::pmt_string_to_symbol("tx_sob"); static const pmt::pmt_t EOB_KEY = pmt::pmt_string_to_symbol("tx_eob"); @@ -56,7 +57,9 @@ public: gr_make_io_signature(0, 0, 0) ), _stream_args(stream_args), - _nchan(std::max<size_t>(1, stream_args.channels.size())) + _nchan(std::max<size_t>(1, stream_args.channels.size())), + _stream_now(_nchan == 1), + _start_time_set(false) { if (stream_args.cpu_format == "fc32") _type = boost::make_shared<uhd::io_type_t>(uhd::io_type_t::COMPLEX_FLOAT32); if (stream_args.cpu_format == "sc16") _type = boost::make_shared<uhd::io_type_t>(uhd::io_type_t::COMPLEX_INT16); @@ -381,6 +384,12 @@ public: } } + void set_start_time(const uhd::time_spec_t &time){ + _start_time = time; + _start_time_set = true; + _stream_now = false; + } + //Send an empty start-of-burst packet to begin streaming. //Set at a time in the near future to avoid late packets. bool start(void){ @@ -390,8 +399,14 @@ public: _metadata.start_of_burst = true; _metadata.end_of_burst = false; - _metadata.has_time_spec = _nchan > 1; - _metadata.time_spec = get_time_now() + uhd::time_spec_t(0.01); + _metadata.has_time_spec = not _stream_now; + if (_start_time_set){ + _start_time_set = false; //cleared for next run + _metadata.time_spec = _start_time; + } + else{ + _metadata.time_spec = get_time_now() + uhd::time_spec_t(0.01); + } #ifdef GR_UHD_USE_STREAM_API _tx_stream->send( @@ -432,9 +447,13 @@ private: uhd::tx_streamer::sptr _tx_stream; #endif size_t _nchan; + bool _stream_now; uhd::tx_metadata_t _metadata; double _sample_rate; + uhd::time_spec_t _start_time; + bool _start_time_set; + //stream tags related stuff std::vector<gr_tag_t> _tags; }; @@ -465,6 +484,7 @@ boost::shared_ptr<uhd_usrp_sink> uhd_make_usrp_sink( const uhd::device_addr_t &device_addr, const uhd::stream_args_t &stream_args ){ + gr_uhd_check_abi(); return boost::shared_ptr<uhd_usrp_sink>( new uhd_usrp_sink_impl(device_addr, stream_args) ); diff --git a/gr-uhd/lib/gr_uhd_usrp_source.cc b/gr-uhd/lib/gr_uhd_usrp_source.cc index 5d3a3321e..bd7f4e21d 100644 --- a/gr-uhd/lib/gr_uhd_usrp_source.cc +++ b/gr-uhd/lib/gr_uhd_usrp_source.cc @@ -1,5 +1,5 @@ /* - * Copyright 2010-2011 Free Software Foundation, Inc. + * Copyright 2010-2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -25,6 +25,7 @@ #include <iostream> #include <boost/format.hpp> #include <boost/make_shared.hpp> +#include "gr_uhd_common.h" static const pmt::pmt_t TIME_KEY = pmt::pmt_string_to_symbol("rx_time"); @@ -58,7 +59,8 @@ public: _stream_args(stream_args), _nchan(std::max<size_t>(1, stream_args.channels.size())), _stream_now(_nchan == 1), - _tag_now(false) + _tag_now(false), + _start_time_set(false) { if (stream_args.cpu_format == "fc32") _type = boost::make_shared<uhd::io_type_t>(uhd::io_type_t::COMPLEX_FLOAT32); if (stream_args.cpu_format == "sc16") _type = boost::make_shared<uhd::io_type_t>(uhd::io_type_t::COMPLEX_INT16); @@ -146,7 +148,7 @@ public: return _dev->set_rx_bandwidth(bandwidth, chan); } - void set_dc_offset(const bool enable, size_t chan){ + void set_auto_dc_offset(const bool enable, size_t chan){ #ifdef UHD_USRP_MULTI_USRP_FRONTEND_CAL_API return _dev->set_rx_dc_offset(enable, chan); #else @@ -371,6 +373,12 @@ public: return num_samps; } + void set_start_time(const uhd::time_spec_t &time){ + _start_time = time; + _start_time_set = true; + _stream_now = false; + } + bool start(void){ #ifdef GR_UHD_USE_STREAM_API _rx_stream = _dev->get_rx_stream(_stream_args); @@ -380,7 +388,13 @@ public: static const double reasonable_delay = 0.1; //order of magnitude over RTT uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS); stream_cmd.stream_now = _stream_now; - stream_cmd.time_spec = get_time_now() + uhd::time_spec_t(reasonable_delay); + if (_start_time_set){ + _start_time_set = false; //cleared for next run + stream_cmd.time_spec = _start_time; + } + else{ + stream_cmd.time_spec = get_time_now() + uhd::time_spec_t(reasonable_delay); + } _dev->issue_stream_cmd(stream_cmd); _tag_now = true; return true; @@ -418,17 +432,48 @@ public: } std::vector<std::complex<float> > finite_acquisition(const size_t nsamps){ + if (_nchan != 1) throw std::runtime_error("finite_acquisition: usrp source has multiple channels, call finite_acquisition_v"); + return finite_acquisition_v(nsamps).front(); + } + + std::vector<std::vector<std::complex<float> > > finite_acquisition_v(const size_t nsamps){ #ifdef GR_UHD_USE_STREAM_API + + //kludgy way to ensure rx streamer exsists + if (!_rx_stream){ + this->start(); + this->stop(); + } + + //flush so there is no queued-up data + this->flush(); + + //create a multi-dimensional container to hold an array of sample buffers + std::vector<std::vector<std::complex<float> > > samps(_nchan, std::vector<std::complex<float> >(nsamps)); + + //load the void* vector of buffer pointers + std::vector<void *> buffs(_nchan); + for (size_t i = 0; i < _nchan; i++){ + buffs[i] = &samps[i].front(); + } + + //tell the device to stream a finite amount uhd::stream_cmd_t cmd(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE); cmd.num_samps = nsamps; - cmd.stream_now = true; + cmd.stream_now = _stream_now; + static const double reasonable_delay = 0.1; //order of magnitude over RTT + cmd.time_spec = get_time_now() + uhd::time_spec_t(reasonable_delay); _dev->issue_stream_cmd(cmd); - std::vector<std::complex<float> > samps(nsamps); + //receive samples until timeout const size_t actual_num_samps = _rx_stream->recv( - &samps.front(), nsamps, _metadata, 0.1 + buffs, nsamps, _metadata, 1.0 ); - samps.resize(actual_num_samps); + + //resize the resulting sample buffers + for (size_t i = 0; i < _nchan; i++){ + samps[i].resize(actual_num_samps); + } return samps; #else @@ -448,6 +493,9 @@ private: bool _stream_now, _tag_now; uhd::rx_metadata_t _metadata; pmt::pmt_t _id; + + uhd::time_spec_t _start_time; + bool _start_time_set; }; @@ -477,6 +525,7 @@ boost::shared_ptr<uhd_usrp_source> uhd_make_usrp_source( const uhd::device_addr_t &device_addr, const uhd::stream_args_t &stream_args ){ + gr_uhd_check_abi(); return boost::shared_ptr<uhd_usrp_source>( new uhd_usrp_source_impl(device_addr, stream_args) ); diff --git a/gr-uhd/swig/__init__.py b/gr-uhd/swig/__init__.py index d098a7b8a..82dbdd9e7 100644 --- a/gr-uhd/swig/__init__.py +++ b/gr-uhd/swig/__init__.py @@ -55,6 +55,10 @@ def _prepare_uhd_swig(): def __new__(self, *args): return str.__new__(self) def __getitem__(self, key): return self.get(key) def __setitem__(self, key, val): self.set(key, val) + def __init__(self, *args, **kwargs): + super(device_addr_t, self).__init__(*args) + if args and isinstance(args[0], device_addr_t): + for key in args[0].keys(): self[key] = args[0][key] setattr(uhd_swig, 'device_addr_t', device_addr_t) #make the streamer args take **kwargs on init |