Skip to content

Commit

Permalink
label convention for discovered hackrfs
Browse files Browse the repository at this point in the history
  • Loading branch information
guruofquality committed Feb 1, 2017
1 parent 497f38d commit 0295455
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -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

Expand Down
7 changes: 7 additions & 0 deletions HackRF_Registation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ static std::vector<SoapySDR::Kwargs> 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;
Expand Down
9 changes: 2 additions & 7 deletions HackRF_Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 0295455

Please sign in to comment.