1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-15 21:01:45 -05:00

HackRF: fixed hackRF library initialization

This commit is contained in:
f4exb 2019-10-11 01:36:00 +02:00
parent 647ce8bc67
commit 1625ff0450

View File

@ -68,13 +68,19 @@ hackrf_device *DeviceHackRF::open_hackrf(const char * const serial)
hackrf_device *DeviceHackRF::open_hackrf_from_sequence(int sequence) hackrf_device *DeviceHackRF::open_hackrf_from_sequence(int sequence)
{ {
instance();
hackrf_device_list_t *hackrf_devices = hackrf_device_list(); hackrf_device_list_t *hackrf_devices = hackrf_device_list();
if (hackrf_devices == nullptr) {
return nullptr;
}
hackrf_device *hackrf_ptr; hackrf_device *hackrf_ptr;
hackrf_error rc; hackrf_error rc;
instance();
rc = (hackrf_error) hackrf_device_list_open(hackrf_devices, sequence, &hackrf_ptr); rc = (hackrf_error) hackrf_device_list_open(hackrf_devices, sequence, &hackrf_ptr);
hackrf_device_list_free(hackrf_devices);
if (rc == HACKRF_SUCCESS) if (rc == HACKRF_SUCCESS)
{ {
@ -89,6 +95,8 @@ hackrf_device *DeviceHackRF::open_hackrf_from_sequence(int sequence)
void DeviceHackRF::enumOriginDevices(const QString& hardwareId, PluginInterface::OriginDevices& originDevices) void DeviceHackRF::enumOriginDevices(const QString& hardwareId, PluginInterface::OriginDevices& originDevices)
{ {
instance();
hackrf_device_list_t *hackrf_devices = hackrf_device_list(); hackrf_device_list_t *hackrf_devices = hackrf_device_list();
if (hackrf_devices == nullptr) { if (hackrf_devices == nullptr) {