1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-09-02 13:17:48 -04:00

HackRF plugin: initialize hackrf library before trying to enumerate

This commit is contained in:
f4exb 2016-03-12 23:17:51 +01:00
parent c483bb815d
commit 1ba3324844

View File

@ -54,22 +54,18 @@ void HackRFPlugin::initPlugin(PluginAPI* pluginAPI)
PluginInterface::SampleSourceDevices HackRFPlugin::enumSampleSources() PluginInterface::SampleSourceDevices HackRFPlugin::enumSampleSources()
{ {
SampleSourceDevices result; hackrf_error rc = (hackrf_error) hackrf_init();
hackrf_device_list_t *hackrf_devices = hackrf_device_list();
hackrf_device *hackrf_ptr;
read_partid_serialno_t read_partid_serialno;
hackrf_error rc;
int i;
rc = (hackrf_error) hackrf_init();
if (rc != HACKRF_SUCCESS) if (rc != HACKRF_SUCCESS)
{ {
qCritical("HackRFPlugin::SampleSourceDevices: failed to initiate HackRF library: %s", hackrf_error_name(rc)); qCritical("HackRFPlugin::SampleSourceDevices: failed to initiate HackRF library: %s", hackrf_error_name(rc));
} }
SampleSourceDevices result;
hackrf_device_list_t *hackrf_devices = hackrf_device_list();
hackrf_device *hackrf_ptr;
read_partid_serialno_t read_partid_serialno;
int i;
for (i=0; i < hackrf_devices->devicecount; i++) for (i=0; i < hackrf_devices->devicecount; i++)
{ {