Skip to content

Commit f30c30e

Browse files
gsparrow9shajen
authored andcommitted
Fixed rtlsdr_get_index_by_serial(1) issue.
1 parent 1e79b12 commit f30c30e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

sources/radio/sdr_device_reader.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ std::vector<nlohmann::json> getGains(SoapySDR::Device* sdr) {
3535
}
3636

3737
void SdrDeviceReader::updateSoapyDevice(nlohmann::json& json, const SoapySDR::Kwargs args) {
38-
const auto serial = removeZerosFromBegging(args.at("serial"));
38+
const auto serial = args.at("serial");
3939
const auto driver = args.at("driver");
4040
Logger::info(LABEL, "update device, driver: {}, serial: {}", colored(GREEN, "{}", driver), colored(GREEN, "{}", serial));
4141

@@ -57,7 +57,7 @@ void SdrDeviceReader::updateSoapyDevice(nlohmann::json& json, const SoapySDR::Kw
5757
}
5858

5959
void SdrDeviceReader::createSoapyDevices(nlohmann::json& json, const SoapySDR::Kwargs args) {
60-
const auto serial = removeZerosFromBegging(args.at("serial"));
60+
const auto serial = args.at("serial");
6161
const auto driver = args.at("driver");
6262
Logger::info(LABEL, "creating device, driver: {}, serial: {}", colored(GREEN, "{}", driver), colored(GREEN, "{}", serial));
6363

@@ -111,8 +111,8 @@ void SdrDeviceReader::scanSoapyDevices(nlohmann::json& json) {
111111
for (uint32_t i = 0; i < results.size(); ++i) {
112112
try {
113113
auto& devices = json.at("devices");
114-
const auto serial = removeZerosFromBegging(results[i].at("serial"));
115-
const auto f = [serial](nlohmann::json& device) { return removeZerosFromBegging(device.at("serial").get<std::string>()) == serial; };
114+
const auto serial = results[i].at("serial");
115+
const auto f = [serial](nlohmann::json& device) { return device.at("serial").get<std::string>() == serial; };
116116
const auto it = std::find_if(devices.begin(), devices.end(), f);
117117
if (it != devices.end()) {
118118
updateSoapyDevice(*it, results[i]);
@@ -138,7 +138,7 @@ Device SdrDeviceReader::readDevice(const nlohmann::json& json) {
138138
const auto value = item.at("value").get<float>();
139139
device.m_gains.emplace_back(key, value);
140140
}
141-
device.m_serial = removeZerosFromBegging(json.at("serial").get<std::string>());
141+
device.m_serial = json.at("serial").get<std::string>();
142142
device.m_sampleRate = json.at("sample_rate").get<Frequency>();
143143
for (const auto& item : json.at("ranges")) {
144144
const auto start = item.at("start").get<Frequency>();

0 commit comments

Comments
 (0)