diff --git a/Changelog.txt b/Changelog.txt index fd6a946..510df4d 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,6 +1,7 @@ Release 0.2.3 (2017-01-27) ========================== +- Added label convention to hackrf discovery routine - Support filtering specific devices by serial number - Switch to format constants in streaming implementation diff --git a/HackRF_Registation.cpp b/HackRF_Registation.cpp index 2afbb1a..9430e17 100644 --- a/HackRF_Registation.cpp +++ b/HackRF_Registation.cpp @@ -73,6 +73,13 @@ static std::vector find_HackRF(const SoapySDR::Kwargs &args) read_partid_serialno.serial_no[3]); options["serial"] = serial_str; + //generate a displayable label string with trimmed serial + size_t ofs = 0; + while (ofs < sizeof(serial_str) and serial_str[ofs] == '0') ofs++; + char label_str[100]; + sprintf(label_str, "%s #%d %s", options["device"].c_str(), i, serial_str+ofs); + options["label"] = label_str; + //filter based on serial and idx const bool serialMatch = args.count("serial") == 0 or args.at("serial") == options["serial"]; const bool idxMatch = args.count("hackrf") == 0 or std::stoi(args.at("hackrf")) == i; diff --git a/HackRF_Settings.cpp b/HackRF_Settings.cpp index 8a0a2c9..475e879 100644 --- a/HackRF_Settings.cpp +++ b/HackRF_Settings.cpp @@ -25,13 +25,8 @@ SoapyHackRF::SoapyHackRF( const SoapySDR::Kwargs &args ) { - std::string argsStr; - for (const auto &pair : args) - { - if (not argsStr.empty()) argsStr += ", "; - argsStr += pair.first + "=" + pair.second; - } - SoapySDR_logf( SOAPY_SDR_INFO, "Opening HackRF device instance {%s}...", argsStr.c_str()); + if (args.count("label") != 0) + SoapySDR_logf( SOAPY_SDR_INFO, "Opening %s...", args.at("label").c_str()); _rx_stream=new RXStream();