Maybe fixed airspy and airspyhf crash

This commit is contained in:
Ryzerth 2021-02-08 20:27:05 +01:00
parent c846e0f400
commit 35d079beb1
2 changed files with 24 additions and 8 deletions

View File

@ -106,6 +106,7 @@ public:
void selectBySerial(uint64_t serial) {
airspy_device* dev;
try {
int err = airspy_open_sn(&dev, serial);
if (err != 0) {
char buf[1024];
@ -114,6 +115,12 @@ public:
selectedSerial = 0;
return;
}
}
catch (std::exception e) {
char buf[1024];
sprintf(buf, "%016" PRIX64, serial);
spdlog::error("Could not open Airspy HF+ {0}", buf);
}
selectedSerial = serial;
uint32_t sampleRates[256];

View File

@ -109,15 +109,24 @@ public:
}
void selectBySerial(uint64_t serial) {
selectedSerial = serial;
airspyhf_device_t* dev;
try {
int err = airspyhf_open_sn(&dev, selectedSerial);
if (err != 0) {
char buf[1024];
sprintf(buf, "%016" PRIX64, selectedSerial);
spdlog::error("Could not open Airspy HF+ {0}", buf);
selectedSerial = 0;
return;
}
}
catch (std::exception e) {
char buf[1024];
sprintf(buf, "%016" PRIX64, selectedSerial);
spdlog::error("Could not open Airspy HF+ {0}", buf);
}
selectedSerial = serial;
uint32_t sampleRates[256];
airspyhf_get_samplerates(dev, sampleRates, 0);