forked from sdr/gr-osmosdr
apps: check for sample rate availability
This commit is contained in:
parent
ba5c6c8da6
commit
eaec4c5acc
|
@ -97,6 +97,12 @@ class app_top_block(stdgui2.std_top_block, pubsub):
|
|||
|
||||
self.src = osmosdr.source_c(options.args)
|
||||
|
||||
try:
|
||||
self.src.get_sample_rates().start()
|
||||
except RuntimeError:
|
||||
print "Source has no sample rates (wrong device arguments?)."
|
||||
sys.exit(1)
|
||||
|
||||
# Set the antenna
|
||||
if(options.antenna):
|
||||
self.src.set_antenna(options.antenna)
|
||||
|
|
|
@ -159,6 +159,12 @@ class top_block(gr.top_block, pubsub):
|
|||
def _setup_osmosdr(self, options):
|
||||
self._sink = osmosdr.sink_c(options.args)
|
||||
|
||||
try:
|
||||
self._sink.get_sample_rates().start()
|
||||
except RuntimeError:
|
||||
print "Sink has no sample rates (wrong device arguments?)."
|
||||
sys.exit(1)
|
||||
|
||||
if options.samp_rate is None:
|
||||
options.samp_rate = self._sink.get_sample_rates().start()
|
||||
|
||||
|
|
|
@ -149,6 +149,12 @@ class my_top_block(gr.top_block):
|
|||
# build graph
|
||||
self.u = osmosdr.source_c(options.args)
|
||||
|
||||
try:
|
||||
self.u.get_sample_rates().start()
|
||||
except RuntimeError:
|
||||
print "Source has no sample rates (wrong device arguments?)."
|
||||
sys.exit(1)
|
||||
|
||||
# Set the antenna
|
||||
if(options.antenna):
|
||||
self.u.set_antenna(options.antenna, 0)
|
||||
|
|
Loading…
Reference in New Issue