From 3e7ca8bfb95658dd9204e1d859e572b82e3b80d4 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Fri, 21 Oct 2011 18:51:07 -0400 Subject: uhd: fixing uhd apps to take a subdev spec; also changing to more general uhd parameter of 'args' instead of 'address' which defaults to the first uhd dev found. --- gr-uhd/apps/uhd_siggen.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'gr-uhd/apps/uhd_siggen.py') diff --git a/gr-uhd/apps/uhd_siggen.py b/gr-uhd/apps/uhd_siggen.py index 921ba44b5..4b7060460 100755 --- a/gr-uhd/apps/uhd_siggen.py +++ b/gr-uhd/apps/uhd_siggen.py @@ -92,12 +92,18 @@ class top_block(gr.top_block, pubsub): self[TYPE_KEY] = options.type #set type last def _setup_usrpx(self, options): - self._u = uhd.usrp_sink(device_addr=options.address, + self._u = uhd.usrp_sink(device_addr=options.args, io_type=uhd.io_type.COMPLEX_FLOAT32, num_channels=1) self._u.set_samp_rate(options.samp_rate) + + # 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) + self._u.set_antenna(options.antenna, 0) self.publish(DESC_KEY, lambda: str(self._u)) self.publish(FREQ_RANGE_KEY, self._u.get_freq_range) @@ -280,9 +286,10 @@ def get_options(): usage="%prog: [options]" parser = OptionParser(option_class=eng_option, usage=usage) - parser.add_option("-a", "--address", type="string", - default="addr=192.168.10.2", - help="Address of UHD device, [default=%default]") + parser.add_option("-a", "--args", type="string", default="", + help="UHD device address args , [default=%default]") + parser.add_option("", "--spec", type="string", default=None, + help="Subdevice of UHD device where appropriate") parser.add_option("-A", "--antenna", type="string", default=None, help="select Rx Antenna where appropriate") parser.add_option("-s", "--samp-rate", type="eng_float", default=1e6, -- cgit