Clarify the error messages printed when trying to open a RF device.

This commit is contained in:
faluco 2021-10-14 20:07:37 +02:00 committed by faluco
parent fd998dac15
commit 95b4a92f5f
2 changed files with 31 additions and 12 deletions

View File

@ -94,6 +94,14 @@ int srsran_rf_open_devname(srsran_rf_t* rf, const char* devname, char* args, uin
{
rf->thread_gain_run = false;
bool no_rf_devs_detected = true;
printf("Available RF device list:");
for (unsigned int i = 0; available_devices[i]; i++) {
no_rf_devs_detected = false;
printf(" %s ", available_devices[i]->name);
}
printf("%s\n", no_rf_devs_detected ? " <none>" : "");
// Try to open the device if name is provided
if (devname && devname[0] != '\0') {
int i = 0;
@ -104,21 +112,30 @@ int srsran_rf_open_devname(srsran_rf_t* rf, const char* devname, char* args, uin
}
i++;
}
ERROR("RF device '%s' not found. Please check the available srsRAN CMAKE options to verify if this device is being "
"detected in your system",
devname);
// provided device not found, abort
return SRSRAN_ERROR;
} else {
// auto-mode, try to open in order of apperance in available_devices[] array
int i = 0;
while (available_devices[i] != NULL) {
if (!available_devices[i]->srsran_rf_open_multi(args, &rf->handler, nof_channels)) {
rf->dev = available_devices[i];
return SRSRAN_SUCCESS;
}
i++;
}
}
ERROR("No compatible RF frontend found");
// auto-mode, try to open in order of apperance in available_devices[] array
int i = 0;
while (available_devices[i] != NULL) {
printf("Trying to open RF device '%s'\n", available_devices[i]->name);
if (!available_devices[i]->srsran_rf_open_multi(args, &rf->handler, nof_channels)) {
rf->dev = available_devices[i];
printf("RF device '%s' successfully opened\n", available_devices[i]->name);
return SRSRAN_SUCCESS;
}
printf("Unable to open RF device '%s'\n", available_devices[i]->name);
i++;
}
ERROR(
"Failed to open a RF frontend device. Please check the available srsRAN CMAKE options to verify what RF frontend "
"devices have been detected in your system");
return SRSRAN_ERROR;
}

View File

@ -278,7 +278,9 @@ int rf_zmq_open_multi(char* args, void** h, uint32_t nof_channels)
}
}
} else {
fprintf(stderr, "[zmq] Error: RF device args are required for ZMQ no-RF module\n");
fprintf(stderr,
"[zmq] Error: No device 'args' option has been set. Please make sure to set this option to be able to "
"use the ZMQ no-RF module\n");
goto clean_exit;
}