Filter out SoapyAudio devices

When gr-osmosdr is compiled with SoapySDR support and SoapyAudio is
installed the audio device is picked as a first choice when detecting
devices but grgsm tools are not able to work with audio devices. So in
such cases the user has to always specify the correct SDR device in the
args parameter which is a bit inconvenient.

When args is not specified call osmosdr.device_find to get all devices
and filter out unspported ones like SoapyAudio devices. When args is
specifed just try to create osmosdr.source with whatever value has been
specified.

Add -l and --list-devices command line option that prints information
about all detected devices.

Example commands:
  grgsm_capture --list-devices
  grgsm_capture --list-devices --args=nofake
  grgsm_capture --args=uhd,type=b210 -a 111 capture.cfile
  grgsm_livemon --args=rtl
  grgsm_livemon --args=uhd,type=b210

Change-Id: Ib84081041ca6c2bc18b9da0c32bac9d3ecef65ca
diff --git a/apps/helpers/grgsm_capture b/apps/helpers/grgsm_capture
index 081544a..f3886ba 100755
--- a/apps/helpers/grgsm_capture
+++ b/apps/helpers/grgsm_capture
@@ -53,8 +53,8 @@
         # Setting up RF source
         ##################################################
 
-        self.sdr_source = \
-                    osmosdr.source(args="numchan=" + str(1) + " " + device_args)
+        self.sdr_source = osmosdr.source(args="numchan=" + str(1) + " " +
+                str(grgsm.device.get_default_args(device_args)))
 
         self.sdr_source.set_sample_rate(samp_rate)
         self.sdr_source.set_center_freq(freq, 0)
@@ -141,12 +141,19 @@
 
     osmogroup.add_option("", "--args", dest="device_args", type="string",
                       default="", help="Set device arguments "
-                      "[default=%default]")
+                      "[default=%default]. Use --list-devices the view the available devices")
+
+    osmogroup.add_option("-l", "--list-devices", action="store_true",
+                      help="List available SDR devices, use --args to specify hints")
 
     parser.add_option_group(osmogroup)
 
     (options, args) = parser.parse_args()
 
+    if options.list_devices:
+        grgsm.device.print_devices(options.device_args)
+        sys.exit(0)
+
     if not args:
         parser.error("Please provide an output file name to save the captured data\n")