I've attached patch files that fix a number of GNU Radio programs that were broken, at least on my machine. Please let me know if any of these patches is incorrect!
By the way, I found my FSF copyright assignment form for GNU Radio crumpled in a drawer yesterday, and mailed a replacement today. Description of changes: The primary change I've made moves subdevice and antenna selection to happen immediately after the creation of a UHD/SHD source/sinkin various Python example/utility programs, which fixes a bug that prevented some of those programs from working with certain hardware configurations, described below. An additional issue that prevented QAing this fix was also fixed: the obsolete import line "from usrpm import usrp_dbid" was removed wherever present. Finally, two minor, unrelated issues discovered during QA were fixed: * gr-uhd/apps/uhd_rx_nogui.py: Corrected help text that listed available modulation options as "AM,FM" to read "AM,FM,WFM". * gr-uhd/apps/uhd_rx_nogui.py: Changed the --gain option to be of type "eng_float" (which appears correct and is used by all other applications) rather than "int". Rationale: 1) Bug fix: In a USRP1 containing two daughterboards, one of which supports the FM or TV frequency range and one of which does not [specifically, in my test case, a WBX in slot A and a DBSRX in slot B], a number of sample applications were dying with "Radio does not support required frequency range" errors. This turned out to be because the calls to check the available frequency and gain ranges were happening before the correct daughterboard was selected. The affected applications were: gr-uhd/examples/usrp_tv_rcv.py gr-uhd/examples/usrp_wfm_rcv.py gr-uhd/examples/usrp_wfm_rcv_fmdet.py gr-uhd/examples/usrp_wfm_rcv_nogui.py gr-uhd/examples/usrp_wfm_rcv_pll.py gr-uhd/examples/usrp_wfm_rcv_sca.py gr-uhd/examples/usrp_wxapt_rcv.py 2) Consistency and reasonableness: A number of other applications were structured very similarly to the affected applications. While they didn't trigger the same fatal error, maintaining code consistency with the patched applications seemed important, and setting frequency and gain after choosing the correct daughterboard seemed like the right thing to do. Applications modified for consistency were: gr-digital/examples/narrowband/uhd_interface.py gr-digital/examples/ofdm/uhd_interface.py gr-qtgui/apps/uhd_display.py gr-shd/apps/shd_fft.py gr-uhd/apps/uhd_fft.py gr-uhd/apps/uhd_rx_cfile.py gr-uhd/apps/uhd_rx_nogui.py gr-uhd/examples/fm_tx4.py gr-uhd/examples/usrp_am_mw_rcv.py gr-uhd/examples/usrp_nbfm_ptt.py gr-uhd/examples/usrp_nbfm_rcv.py gr-uhd/examples/usrp_spectrum_sense.py gr-uhd/examples/usrp_tv_rcv_nogui.py 3) usrpm import removal: Fixes fatal ImportErrors on UHD-only installations. Applications affected: gr-uhd/examples/fm_tx4.py gr-uhd/examples/usrp_am_mw_rcv.py gr-uhd/examples/usrp_nbfm_ptt.py gr-uhd/examples/usrp_wfm_rcv2_nogui.py QA: * These formerly broken apps now work: gr-uhd/examples/usrp_tv_rcv.py gr-uhd/examples/usrp_wfm_rcv.py gr-uhd/examples/usrp_wfm_rcv_nogui.py gr-uhd/examples/usrp_wfm_rcv_pll.py gr-uhd/examples/usrp_wfm_rcv_sca.py gr-uhd/examples/usrp_wxapt_rcv.py * These formerly working apps still work: gr-uhd/apps/uhd_fft.py gr-uhd/apps/uhd_rx_cfile.py gr-uhd/apps/uhd_rx_nogui.py gr-uhd/examples/fm_tx4.py gr-uhd/examples/usrp_am_mw_rcv.py gr-uhd/examples/usrp_nbfm_rcv.py gr-uhd/examples/usrp_tv_rcv_nogui.py gr-uhd/examples/usrp_wfm_rcv2_nogui.py * These formerly broken apps are still broken for other reasons: gr-uhd/examples/usrp_nbfm_ptt.py (throws TypeError) gr-uhd/examples/usrp_spectrum_sense.py (segfaults) gr-uhd/examples/usrp_wfm_rcv_fmdet.py (segfaults) * I was unable to test these due to lack of appropriate hardware: gr-digital/examples/narrowband/uhd_interface.py gr-digital/examples/ofdm/uhd_interface.py gr-qtgui/apps/uhd_display.py gr-shd/apps/shd_fft.py
>From a4bd8506050b16863969f8d40999feb3d683fa4c Mon Sep 17 00:00:00 2001 From: Sam Bretheim <s...@opensigint.org> Date: Tue, 13 Dec 2011 20:44:36 -0800 Subject: [PATCH 1/2] Moved subdev and antenna selection to happen immediately after UHD USRP device creation (fixes USRP1 errors) --- gr-digital/examples/narrowband/uhd_interface.py | 16 +++++++------- gr-digital/examples/ofdm/uhd_interface.py | 16 +++++++------- gr-qtgui/apps/uhd_display.py | 7 +++-- gr-shd/apps/shd_fft.py | 6 ++-- gr-uhd/apps/uhd_fft.py | 8 +++--- gr-uhd/apps/uhd_rx_cfile.py | 16 +++++++------- gr-uhd/apps/uhd_rx_nogui.py | 24 +++++++++++----------- gr-uhd/examples/fm_tx4.py | 16 +++++++------- gr-uhd/examples/usrp_am_mw_rcv.py | 16 +++++++------- gr-uhd/examples/usrp_nbfm_ptt.py | 16 +++++++------- gr-uhd/examples/usrp_nbfm_rcv.py | 16 +++++++------- gr-uhd/examples/usrp_spectrum_sense.py | 16 +++++++------- gr-uhd/examples/usrp_tv_rcv.py | 16 +++++++------- gr-uhd/examples/usrp_tv_rcv_nogui.py | 16 +++++++------- gr-uhd/examples/usrp_wfm_rcv.py | 16 +++++++------- gr-uhd/examples/usrp_wfm_rcv_fmdet.py | 16 +++++++------- gr-uhd/examples/usrp_wfm_rcv_nogui.py | 16 +++++++------- gr-uhd/examples/usrp_wfm_rcv_pll.py | 16 +++++++------- gr-uhd/examples/usrp_wfm_rcv_sca.py | 16 +++++++------- gr-uhd/examples/usrp_wxapt_rcv.py | 16 +++++++------- 20 files changed, 151 insertions(+), 150 deletions(-) diff --git a/gr-digital/examples/narrowband/uhd_interface.py b/gr-digital/examples/narrowband/uhd_interface.py index 27e3709..fe022c7 100644 --- a/gr-digital/examples/narrowband/uhd_interface.py +++ b/gr-digital/examples/narrowband/uhd_interface.py @@ -50,14 +50,6 @@ class uhd_interface: else: self.u = uhd.usrp_source(device_addr=args, stream_args=uhd.stream_args('fc32')) - self._args = args - self._ant = antenna - self._spec = spec - self._gain = self.set_gain(gain) - self._freq = self.set_freq(freq) - - self._rate, self._sps = self.set_sample_rate(sym_rate, sps) - # Set the subdevice spec if(spec): self.u.set_subdev_spec(spec, 0) @@ -66,6 +58,14 @@ class uhd_interface: if(antenna): self.u.set_antenna(antenna, 0) + self._args = args + self._ant = antenna + self._spec = spec + self._gain = self.set_gain(gain) + self._freq = self.set_freq(freq) + + self._rate, self._sps = self.set_sample_rate(sym_rate, sps) + def set_sample_rate(self, sym_rate, req_sps): start_sps = req_sps while(True): diff --git a/gr-digital/examples/ofdm/uhd_interface.py b/gr-digital/examples/ofdm/uhd_interface.py index 14a542b..e4b1395 100644 --- a/gr-digital/examples/ofdm/uhd_interface.py +++ b/gr-digital/examples/ofdm/uhd_interface.py @@ -50,14 +50,6 @@ class uhd_interface: else: self.u = uhd.usrp_source(device_addr=args, stream_args=uhd.stream_args('fc32')) - self._args = args - self._ant = antenna - self._spec = spec - self._gain = self.set_gain(gain) - self._freq = self.set_freq(freq) - - self._rate = self.set_sample_rate(bandwidth) - # Set the subdevice spec if(spec): self.u.set_subdev_spec(spec, 0) @@ -66,6 +58,14 @@ class uhd_interface: if(antenna): self.u.set_antenna(antenna, 0) + self._args = args + self._ant = antenna + self._spec = spec + self._gain = self.set_gain(gain) + self._freq = self.set_freq(freq) + + self._rate = self.set_sample_rate(bandwidth) + def set_sample_rate(self, bandwidth): self.u.set_samp_rate(bandwidth) actual_bw = self.u.get_samp_rate() diff --git a/gr-qtgui/apps/uhd_display.py b/gr-qtgui/apps/uhd_display.py index 94e4f09..30325a2 100755 --- a/gr-qtgui/apps/uhd_display.py +++ b/gr-qtgui/apps/uhd_display.py @@ -172,6 +172,10 @@ class my_top_block(gr.top_block): self.qapp = QtGui.QApplication(sys.argv) self.u = uhd.usrp_source(device_addr=options.address, stream_args=uhd.stream_args('fc32')) + + if(options.antenna): + self.u.set_antenna(options.antenna, 0) + self.set_bandwidth(options.samp_rate) if options.gain is None: @@ -186,9 +190,6 @@ class my_top_block(gr.top_block): options.freq = float(r.start()+r.stop())/2 self.set_frequency(options.freq) - if(options.antenna): - self.u.set_antenna(options.antenna, 0) - self._fftsize = options.fft_size self.snk = qtgui.sink_c(options.fft_size, diff --git a/gr-shd/apps/shd_fft.py b/gr-shd/apps/shd_fft.py index 81e84d3..4683278 100755 --- a/gr-shd/apps/shd_fft.py +++ b/gr-shd/apps/shd_fft.py @@ -71,6 +71,9 @@ class app_top_block(stdgui2.std_top_block): io_type=shd.io_type.COMPLEX_FLOAT32, num_channels=1) + if(options.antenna): + self.src.set_antenna(options.antenna, 0) + self.src.set_samp_rate(options.samp_rate) input_rate = self.src.get_samp_rate() @@ -112,9 +115,6 @@ class app_top_block(stdgui2.std_top_block): self.set_gain(options.gain) - if(options.antenna): - self.src.set_antenna(options.antenna, 0) - if self.show_debug_info: self.myform['samprate'].set_value(self.src.get_samp_rate()) self.myform['fs@gbe'].set_value(input_rate) diff --git a/gr-uhd/apps/uhd_fft.py b/gr-uhd/apps/uhd_fft.py index 7ebf5e1..a9bb143 100755 --- a/gr-uhd/apps/uhd_fft.py +++ b/gr-uhd/apps/uhd_fft.py @@ -85,6 +85,10 @@ class app_top_block(stdgui2.std_top_block): if(options.spec): self.u.set_subdev_spec(options.spec, 0) + # Set the antenna + if(options.antenna): + self.u.set_antenna(options.antenna, 0) + self.u.set_samp_rate(options.samp_rate) input_rate = self.u.get_samp_rate() @@ -128,10 +132,6 @@ class app_top_block(stdgui2.std_top_block): self.set_gain(options.gain) - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) - if self.show_debug_info: self.myform['samprate'].set_value(self.u.get_samp_rate()) self.myform['rffreq'].set_value(0) diff --git a/gr-uhd/apps/uhd_rx_cfile.py b/gr-uhd/apps/uhd_rx_cfile.py index 61d5342..ea2aad8 100755 --- a/gr-uhd/apps/uhd_rx_cfile.py +++ b/gr-uhd/apps/uhd_rx_cfile.py @@ -47,6 +47,14 @@ class rx_cfile_block(gr.top_block): self._u = uhd.usrp_source(device_addr=options.args, stream_args=uhd.stream_args('fc32')) self._sink = gr.file_sink(gr.sizeof_gr_complex, filename) + # Set the subdevice spec + if(options.spec): + self._u.set_subdev_spec(options.spec, 0) + + # Set the antenna + if(options.antenna): + self._u.set_antenna(options.antenna, 0) + # Set receiver sample rate self._u.set_samp_rate(options.samp_rate) @@ -57,14 +65,6 @@ class rx_cfile_block(gr.top_block): print "Using mid-point gain of", options.gain, "(", g.start(), "-", g.stop(), ")" self._u.set_gain(options.gain) - # Set the subdevice spec - if(options.spec): - self._u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self._u.set_antenna(options.antenna, 0) - # Set frequency (tune request takes lo_offset) if(options.lo_offset is not None): treq = uhd.tune_request(options.freq, options.lo_offset) diff --git a/gr-uhd/apps/uhd_rx_nogui.py b/gr-uhd/apps/uhd_rx_nogui.py index 7a2e0a0..e692e6e 100755 --- a/gr-uhd/apps/uhd_rx_nogui.py +++ b/gr-uhd/apps/uhd_rx_nogui.py @@ -90,6 +90,14 @@ class uhd_src(gr.hier_block2): self._src = uhd.usrp_source(device_addr=args, stream_args=uhd.stream_args('fc32')) + # Set the subdevice spec + if(spec): + self._src.set_subdev_spec(spec, 0) + + # Set the antenna + if(antenna): + self._src.set_antenna(antenna, 0) + self._src.set_samp_rate(samp_rate) dev_rate = self._src.get_samp_rate() self._samp_rate = samp_rate @@ -99,20 +107,12 @@ class uhd_src(gr.hier_block2): self._resamp = blks2.pfb_arb_resampler_ccf(self._rrate) # If no gain specified, set to midrange + gain_range = self._src.get_gain_range() if gain is None: - g = self._src.get_gain_range() - gain = (g.start()+g.stop())/2.0 + gain = (gain_range.start()+gain_range.stop())/2.0 print "Using gain: ", gain self._src.set_gain(gain) - # Set the subdevice spec - if(spec): - self._src.set_subdev_spec(spec, 0) - - # Set the antenna - if(antenna): - self._src.set_antenna(antenna, 0) - self._cal = calibration self.connect(self._src, self._resamp, self) @@ -205,12 +205,12 @@ def main(): parser.add_option("-c", "--calibration", type="eng_float", default=0.0, metavar="Hz", help="set frequency offset to Hz [default=%default]") - parser.add_option("-g", "--gain", type="int", + parser.add_option("-g", "--gain", type="eng_float", metavar="dB", default=None, help="set RF gain [default is midpoint]") parser.add_option("-m", "--modulation", type="choice", choices=('AM','FM','WFM'), metavar="TYPE", default=None, - help="set modulation type (AM,FM) [default=%default]") + help="set modulation type (AM,FM,WFM) [default=%default]") parser.add_option("-o", "--output-rate", type="eng_float", default=32000, metavar="RATE", help="set audio output rate to RATE [default=%default]") diff --git a/gr-uhd/examples/fm_tx4.py b/gr-uhd/examples/fm_tx4.py index 714eed3..2bbe757 100755 --- a/gr-uhd/examples/fm_tx4.py +++ b/gr-uhd/examples/fm_tx4.py @@ -119,6 +119,14 @@ class fm_tx_block(stdgui2.std_top_block): self.u = uhd.usrp_sink(device_addr=options.args, stream_args=uhd.stream_args('fc32')) + # Set the subdevice spec + if(options.spec): + self.u.set_subdev_spec(options.spec, 0) + + # Set the antenna + if(options.antenna): + self.u.set_antenna(options.antenna, 0) + self.usrp_rate = options.samp_rate self.u.set_samp_rate(self.usrp_rate) self.usrp_rate = self.u.get_samp_rate() @@ -134,14 +142,6 @@ class fm_tx_block(stdgui2.std_top_block): self.set_gain(options.gain) self.set_freq(options.freq) - # Set the subdevice spec - if(options.spec): - self.u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) - self.sum = gr.add_cc () # Instantiate N NBFM channels diff --git a/gr-uhd/examples/usrp_am_mw_rcv.py b/gr-uhd/examples/usrp_am_mw_rcv.py index 31fe9af..a5ee65f 100755 --- a/gr-uhd/examples/usrp_am_mw_rcv.py +++ b/gr-uhd/examples/usrp_am_mw_rcv.py @@ -77,6 +77,14 @@ class wfm_rx_block (stdgui2.std_top_block): # build graph self.u = uhd.usrp_source(device_addr=options.args, stream_args=uhd.stream_args('fc32')) + # Set the subdevice spec + if(options.spec): + self.u.set_subdev_spec(options.spec, 0) + + # Set the antenna + if(options.antenna): + self.u.set_antenna(options.antenna, 0) + usrp_rate = 256e3 demod_rate = 64e3 audio_rate = 32e3 @@ -150,14 +158,6 @@ class wfm_rx_block (stdgui2.std_top_block): if not(self.set_freq(options.freq)): self._set_status_msg("Failed to set initial frequency") - # Set the subdevice spec - if(options.spec): - self.u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) - def _set_status_msg(self, msg, which=0): self.frame.GetStatusBar().SetStatusText(msg, which) diff --git a/gr-uhd/examples/usrp_nbfm_ptt.py b/gr-uhd/examples/usrp_nbfm_ptt.py index 3b28bc2..6bcbe67 100755 --- a/gr-uhd/examples/usrp_nbfm_ptt.py +++ b/gr-uhd/examples/usrp_nbfm_ptt.py @@ -283,6 +283,14 @@ class transmit_path(gr.hier_block2): self.u = uhd.usrp_sink(device_addr=args, stream_args=uhd.stream_args('fc32')) + # Set the subdevice spec + if(spec): + self.u.set_subdev_spec(spec, 0) + + # Set the antenna + if(antenna): + self.u.set_antenna(antenna, 0) + self.if_rate = 320e3 self.audio_rate = 32e3 @@ -333,14 +341,6 @@ class transmit_path(gr.hier_block2): self.set_enable(False) - # Set the subdevice spec - if(spec): - self.u.set_subdev_spec(spec, 0) - - # Set the antenna - if(antenna): - self.u.set_antenna(antenna, 0) - def set_freq(self, target_freq): """ Set the center frequency we're interested in. diff --git a/gr-uhd/examples/usrp_nbfm_rcv.py b/gr-uhd/examples/usrp_nbfm_rcv.py index 7e15abb..6fdf95a 100755 --- a/gr-uhd/examples/usrp_nbfm_rcv.py +++ b/gr-uhd/examples/usrp_nbfm_rcv.py @@ -268,6 +268,14 @@ class receive_path(gr.hier_block2): self.u = uhd.usrp_source(device_addr=args, stream_args=uhd.stream_args('fc32')) + # Set the subdevice spec + if(spec): + self.u.set_subdev_spec(spec, 0) + + # Set the antenna + if(antenna): + self.u.set_antenna(antenna, 0) + self.if_rate = 256e3 self.quad_rate = 64e3 self.audio_rate = 32e3 @@ -320,14 +328,6 @@ class receive_path(gr.hier_block2): s = self.squelch_range() self.set_squelch((s[0]+s[1])/2) - # Set the subdevice spec - if(spec): - self.u.set_subdev_spec(spec, 0) - - # Set the antenna - if(antenna): - self.u.set_antenna(antenna, 0) - def volume_range(self): return (-20.0, 0.0, 0.5) diff --git a/gr-uhd/examples/usrp_spectrum_sense.py b/gr-uhd/examples/usrp_spectrum_sense.py index ceb95ea..55e0c61 100755 --- a/gr-uhd/examples/usrp_spectrum_sense.py +++ b/gr-uhd/examples/usrp_spectrum_sense.py @@ -133,6 +133,14 @@ class my_top_block(gr.top_block): # build graph self.u = uhd.usrp_source(device_addr=options.args, stream_args=uhd.stream_args('fc32')) + # Set the subdevice spec + if(options.spec): + self.u.set_subdev_spec(options.spec, 0) + + # Set the antenna + if(options.antenna): + self.u.set_antenna(options.antenna, 0) + usrp_rate = options.samp_rate self.u.set_samp_rate(usrp_rate) dev_rate = self.u.get_samp_rate() @@ -182,14 +190,6 @@ class my_top_block(gr.top_block): self.set_gain(options.gain) print "gain =", options.gain - # Set the subdevice spec - if(options.spec): - self.u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) - def set_next_freq(self): target_freq = self.next_freq self.next_freq = self.next_freq + self.freq_step diff --git a/gr-uhd/examples/usrp_tv_rcv.py b/gr-uhd/examples/usrp_tv_rcv.py index 6e61ece..700915b 100755 --- a/gr-uhd/examples/usrp_tv_rcv.py +++ b/gr-uhd/examples/usrp_tv_rcv.py @@ -133,6 +133,14 @@ class tv_rx_block (stdgui2.std_top_block): else: # use a UHD device self.u = uhd.usrp_source(device_addr=options.args, stream_args=uhd.stream_args('fc32')) + # Set the subdevice spec + if(options.spec): + self.u.set_subdev_spec(options.spec, 0) + + # Set the antenna + if(options.antenna): + self.u.set_antenna(options.antenna, 0) + self.u.set_samp_rate(usrp_rate) dev_rate = self.u.get_samp_rate() @@ -143,14 +151,6 @@ class tv_rx_block (stdgui2.std_top_block): self.src=self.u - # Set the subdevice spec - if(options.spec): - self.u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) - self.gain = options.gain f2uc=gr.float_to_uchar() diff --git a/gr-uhd/examples/usrp_tv_rcv_nogui.py b/gr-uhd/examples/usrp_tv_rcv_nogui.py index f6a40d6..870e65b 100755 --- a/gr-uhd/examples/usrp_tv_rcv_nogui.py +++ b/gr-uhd/examples/usrp_tv_rcv_nogui.py @@ -133,6 +133,14 @@ class my_top_block(gr.top_block): # build the graph self.u = uhd.usrp_source(device_addr=options.args, stream_args=uhd.stream_args('fc32')) + # Set the subdevice spec + if(options.spec): + self.u.set_subdev_spec(options.spec, 0) + + # Set the antenna + if(options.antenna): + self.u.set_antenna(options.antenna, 0) + self.u.set_samp_rate(input_rate) dev_rate = self.u.get_samp_rate() @@ -149,14 +157,6 @@ class my_top_block(gr.top_block): sys.stderr.write('Failed to set frequency\n') raise SystemExit, 1 - # Set the subdevice spec - if(options.spec): - self.u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) - self.agc = gr.agc_cc(1e-7,1.0,1.0) #1e-7 self.am_demod = gr.complex_to_mag () diff --git a/gr-uhd/examples/usrp_wfm_rcv.py b/gr-uhd/examples/usrp_wfm_rcv.py index a4abdd2..f6c5cf8 100755 --- a/gr-uhd/examples/usrp_wfm_rcv.py +++ b/gr-uhd/examples/usrp_wfm_rcv.py @@ -71,6 +71,14 @@ class wfm_rx_block (stdgui2.std_top_block): # build graph self.u = uhd.usrp_source(device_addr=options.args, stream_args=uhd.stream_args('fc32')) + # Set the subdevice spec + if(options.spec): + self.u.set_subdev_spec(options.spec, 0) + + # Set the antenna + if(options.antenna): + self.u.set_antenna(options.antenna, 0) + usrp_rate = 320e3 demod_rate = 320e3 audio_rate = 32e3 @@ -129,14 +137,6 @@ class wfm_rx_block (stdgui2.std_top_block): if not(self.set_freq(options.freq)): self._set_status_msg("Failed to set initial frequency") - # Set the subdevice spec - if(options.spec): - self.u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) - def _set_status_msg(self, msg, which=0): self.frame.GetStatusBar().SetStatusText(msg, which) diff --git a/gr-uhd/examples/usrp_wfm_rcv_fmdet.py b/gr-uhd/examples/usrp_wfm_rcv_fmdet.py index 225c960..9649857 100755 --- a/gr-uhd/examples/usrp_wfm_rcv_fmdet.py +++ b/gr-uhd/examples/usrp_wfm_rcv_fmdet.py @@ -73,6 +73,14 @@ class wfm_rx_block (stdgui2.std_top_block): # build graph self.u = uhd.usrp_source(device_addr=options.args, stream_args=uhd.stream_args('fc32')) + # Set the subdevice spec + if(options.spec): + self.u.set_subdev_spec(options.spec, 0) + + # Set the antenna + if(options.antenna): + self.u.set_antenna(options.antenna, 0) + usrp_rate = 320e3 demod_rate = 320e3 audio_rate = 48e3 @@ -151,14 +159,6 @@ class wfm_rx_block (stdgui2.std_top_block): if not(self.set_freq(options.freq)): self._set_status_msg("Failed to set initial frequency") - # Set the subdevice spec - if(options.spec): - self.u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) - def _set_status_msg(self, msg, which=0): self.frame.GetStatusBar().SetStatusText(msg, which) diff --git a/gr-uhd/examples/usrp_wfm_rcv_nogui.py b/gr-uhd/examples/usrp_wfm_rcv_nogui.py index 498d2de..f0195bc 100755 --- a/gr-uhd/examples/usrp_wfm_rcv_nogui.py +++ b/gr-uhd/examples/usrp_wfm_rcv_nogui.py @@ -65,6 +65,14 @@ class wfm_rx_block (gr.top_block): # build graph self.u = uhd.usrp_source(device_addr=options.args, stream_args=uhd.stream_args('fc32')) + # Set the subdevice spec + if(options.spec): + self.u.set_subdev_spec(options.spec, 0) + + # Set the antenna + if(options.antenna): + self.u.set_antenna(options.antenna, 0) + usrp_rate = 320e3 demod_rate = 320e3 audio_rate = 32e3 @@ -119,14 +127,6 @@ class wfm_rx_block (gr.top_block): if not(self.set_freq(options.freq)): self._set_status_msg("Failed to set initial frequency") - # Set the subdevice spec - if(options.spec): - self.u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) - def set_vol (self, vol): g = self.volume_range() self.vol = max(g[0], min(g[1], vol)) diff --git a/gr-uhd/examples/usrp_wfm_rcv_pll.py b/gr-uhd/examples/usrp_wfm_rcv_pll.py index 383670c..b0744b0 100755 --- a/gr-uhd/examples/usrp_wfm_rcv_pll.py +++ b/gr-uhd/examples/usrp_wfm_rcv_pll.py @@ -73,6 +73,14 @@ class wfm_rx_block (stdgui2.std_top_block): # build graph self.u = uhd.usrp_source(device_addr=options.args, stream_args=uhd.stream_args('fc32')) + # Set the subdevice spec + if(options.spec): + self.u.set_subdev_spec(options.spec, 0) + + # Set the antenna + if(options.antenna): + self.u.set_antenna(options.antenna, 0) + usrp_rate = 320e3 demod_rate = 320e3 audio_rate = 48e3 @@ -149,14 +157,6 @@ class wfm_rx_block (stdgui2.std_top_block): if not(self.set_freq(options.freq)): self._set_status_msg("Failed to set initial frequency") - # Set the subdevice spec - if(options.spec): - self.u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) - def _set_status_msg(self, msg, which=0): self.frame.GetStatusBar().SetStatusText(msg, which) diff --git a/gr-uhd/examples/usrp_wfm_rcv_sca.py b/gr-uhd/examples/usrp_wfm_rcv_sca.py index 9b233a7..224f30c 100755 --- a/gr-uhd/examples/usrp_wfm_rcv_sca.py +++ b/gr-uhd/examples/usrp_wfm_rcv_sca.py @@ -102,6 +102,14 @@ class wfm_rx_sca_block (stdgui2.std_top_block): self.u = uhd.usrp_source(device_addr=options.args, stream_args=uhd.stream_args('fc32')) + # Set the subdevice spec + if(options.spec): + self.u.set_subdev_spec(options.spec, 0) + + # Set the antenna + if(options.antenna): + self.u.set_antenna(options.antenna, 0) + usrp_rate = 320e3 demod_rate = 320e3 audio_rate = 32e3 @@ -210,14 +218,6 @@ class wfm_rx_sca_block (stdgui2.std_top_block): if not(self.set_freq(options.freq)): self._set_status_msg("Failed to set initial frequency") self.set_sca_freq(67000) # A common SCA Frequency - - # Set the subdevice spec - if(options.spec): - self.u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) def _set_status_msg(self, msg, which=0): self.frame.GetStatusBar().SetStatusText(msg, which) diff --git a/gr-uhd/examples/usrp_wxapt_rcv.py b/gr-uhd/examples/usrp_wxapt_rcv.py index 78cc7bd..d9b1a01 100755 --- a/gr-uhd/examples/usrp_wxapt_rcv.py +++ b/gr-uhd/examples/usrp_wxapt_rcv.py @@ -71,6 +71,14 @@ class wxapt_rx_block (stdgui2.std_top_block): # build graph self.u = uhd.usrp_source(device_addr=options.args, stream_args=uhd.stream_args('fc32')) + # Set the subdevice spec + if(options.spec): + self.u.set_subdev_spec(options.spec, 0) + + # Set the antenna + if(options.antenna): + self.u.set_antenna(options.antenna, 0) + usrp_rate = 320e3 demod_rate = 320e3 audio_rate = 32e3 @@ -124,14 +132,6 @@ class wxapt_rx_block (stdgui2.std_top_block): if not(self.set_freq(options.freq)): self._set_status_msg("Failed to set initial frequency") - # Set the subdevice spec - if(options.spec): - self.u.set_subdev_spec(options.spec, 0) - - # Set the antenna - if(options.antenna): - self.u.set_antenna(options.antenna, 0) - def _set_status_msg(self, msg, which=0): self.frame.GetStatusBar().SetStatusText(msg, which) -- 1.7.0.4
>From 6472a1952b2fcee0efc12ff5d98014035a0328af Mon Sep 17 00:00:00 2001 From: Sam Bretheim <s...@opensigint.org> Date: Tue, 13 Dec 2011 22:16:40 -0800 Subject: [PATCH 2/2] Removed obsolete usrpm import --- gr-uhd/examples/fm_tx4.py | 1 - gr-uhd/examples/usrp_am_mw_rcv.py | 1 - gr-uhd/examples/usrp_nbfm_ptt.py | 1 - gr-uhd/examples/usrp_wfm_rcv2_nogui.py | 1 - 4 files changed, 0 insertions(+), 4 deletions(-) diff --git a/gr-uhd/examples/fm_tx4.py b/gr-uhd/examples/fm_tx4.py index 2bbe757..aecb35b 100755 --- a/gr-uhd/examples/fm_tx4.py +++ b/gr-uhd/examples/fm_tx4.py @@ -37,7 +37,6 @@ from gnuradio import uhd from gnuradio import blks2 from gnuradio.eng_option import eng_option from optparse import OptionParser -from usrpm import usrp_dbid import math import sys diff --git a/gr-uhd/examples/usrp_am_mw_rcv.py b/gr-uhd/examples/usrp_am_mw_rcv.py index a5ee65f..85ffd76 100755 --- a/gr-uhd/examples/usrp_am_mw_rcv.py +++ b/gr-uhd/examples/usrp_am_mw_rcv.py @@ -28,7 +28,6 @@ from gnuradio.eng_option import eng_option from gnuradio.wxgui import slider, powermate from gnuradio.wxgui import stdgui2, fftsink2, form from optparse import OptionParser -from usrpm import usrp_dbid import sys import math import wx diff --git a/gr-uhd/examples/usrp_nbfm_ptt.py b/gr-uhd/examples/usrp_nbfm_ptt.py index 6bcbe67..075604a 100755 --- a/gr-uhd/examples/usrp_nbfm_ptt.py +++ b/gr-uhd/examples/usrp_nbfm_ptt.py @@ -28,7 +28,6 @@ from optparse import OptionParser from gnuradio import gr, audio, blks2, uhd from gnuradio.eng_option import eng_option from gnuradio.wxgui import stdgui2, fftsink2, scopesink2, slider, form -from usrpm import usrp_dbid from numpy import convolve, array diff --git a/gr-uhd/examples/usrp_wfm_rcv2_nogui.py b/gr-uhd/examples/usrp_wfm_rcv2_nogui.py index 4173468..b70334f 100755 --- a/gr-uhd/examples/usrp_wfm_rcv2_nogui.py +++ b/gr-uhd/examples/usrp_wfm_rcv2_nogui.py @@ -23,7 +23,6 @@ from gnuradio import gr, optfir, audio, blks2, uhd from gnuradio.eng_option import eng_option from optparse import OptionParser -from usrpm import usrp_dbid import sys import math -- 1.7.0.4
_______________________________________________ Patch-gnuradio mailing list Patch-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/patch-gnuradio