Blob Blame History Raw
diff --git a/lib/airspy/airspy_source_c.cc b/lib/airspy/airspy_source_c.cc
index 7fd3be8..1c84387 100644
--- a/lib/airspy/airspy_source_c.cc
+++ b/lib/airspy/airspy_source_c.cc
@@ -95,12 +95,25 @@ airspy_source_c::airspy_source_c (const std::string &args)
     _vga_gain(0),
     _bandwidth(0)
 {
-  int ret;
 
+  int ret;
+  _dev = NULL;
   dict_t dict = params_to_dict(args);
 
-  _dev = NULL;
-  ret = airspy_open( &_dev );
+  // the block below allows one to open airspy by serial number
+  // 2016-Apr-5 - by Lawrence Glaister VE7IT  ve7it@shaw.ca
+  // (allowing multiple airspy source blocks to be used) Note: each airspy should be
+  // plugged into its own USB bus controller to support the high data rates involved.
+  // osmocom Source block usage: Device arguments:  airspy=0x644064DC317C1FCD
+  // if no device arguments are given or s/n=0, the first found airspy device will be used
+  // use airspy_info utility to identify device serial number strings
+  uint64_t sn = 0;
+  std::stringstream ss;
+  ss << std::hex << dict["airspy"];
+  ss >> sn;
+  std::cerr << "Attempting to open airspy by s/n= "
+            <<  boost::format("0x%016X") % (sn) << std::endl;
+  ret = airspy_open_sn( &_dev, sn );
   AIRSPY_THROW_ON_ERROR(ret, "Failed to open AirSpy device")
 
   uint8_t board_id;
@@ -111,11 +124,15 @@ airspy_source_c::airspy_source_c (const std::string &args)
   memset(version, 0, sizeof(version));
   ret = airspy_version_string_read( _dev, version, sizeof(version));
   AIRSPY_THROW_ON_ERROR(ret, "Failed to read version string")
-#if 0
+
   airspy_read_partid_serialno_t part_serial;
   ret = airspy_board_partid_serialno_read( _dev, &part_serial );
   AIRSPY_THROW_ON_ERROR(ret, "Failed to read serial number")
-#endif
+  std::cerr << "Opened Device Serial Number=    "
+    << boost::format("0x%08X") % (part_serial.serial_no[2])
+    << boost::format("%08X")   % (part_serial.serial_no[3])
+    << std::endl;
+
   uint32_t num_rates;
   airspy_get_samplerates(_dev, &num_rates, 0);
   uint32_t *samplerates = (uint32_t *) malloc(num_rates * sizeof(uint32_t));