Skip to content

Commit

Permalink
Exit gracefuly if no SoapySDR device is found
Browse files Browse the repository at this point in the history
  • Loading branch information
xmikos committed Mar 22, 2017
1 parent 69b88e9 commit 5c3a83f
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions soapypower/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,15 +291,18 @@ def main():
power.psd.simplespectral.use_pyfftw = False

# Create SoapyPower instance
sdr = power.SoapyPower(
soapy_args=args.device, sample_rate=args.rate, bandwidth=args.bandwidth, corr=args.ppm,
gain=args.specific_gains if args.specific_gains else args.gain, auto_gain=args.agc,
channel=args.channel, antenna=args.antenna, settings=args.device_settings,
force_sample_rate=args.force_rate, force_bandwidth=args.force_bandwidth,
output=args.output_fd if args.output_fd is not None else args.output,
output_format=args.format
)
logger.info('Using device: {}'.format(sdr.device.hardware))
try:
sdr = power.SoapyPower(
soapy_args=args.device, sample_rate=args.rate, bandwidth=args.bandwidth, corr=args.ppm,
gain=args.specific_gains if args.specific_gains else args.gain, auto_gain=args.agc,
channel=args.channel, antenna=args.antenna, settings=args.device_settings,
force_sample_rate=args.force_rate, force_bandwidth=args.force_bandwidth,
output=args.output_fd if args.output_fd is not None else args.output,
output_format=args.format
)
logger.info('Using device: {}'.format(sdr.device.hardware))
except RuntimeError:
parser.error('No devices found!')

# Prepare arguments for SoapyPower.sweep()
if len(args.freq) < 2:
Expand Down

0 comments on commit 5c3a83f

Please sign in to comment.