rf_imp: fail opening RF altogether if specified device fails to open

we've had a few runs in the CI where opening the specified RF device
failed but the eNB/UE still continued to run, just picking the next available
run. This led to false-positive tests.

The policy should be that whenever the user specified a RF device to
be openend, and this device fails, the whole process should fail and
the application should exit.

The auto-detection mode is still available but only if no device name
is specified at all.
master
Andre Puschmann 3 years ago committed by Xavier Arteaga
parent c9478a4306
commit e563e5918e

@ -93,32 +93,33 @@ const char* srsran_rf_get_devname(srsran_rf_t* rf)
int srsran_rf_open_devname(srsran_rf_t* rf, const char* devname, char* args, uint32_t nof_channels)
{
rf->thread_gain_run = false;
/* Try to open the device if name is provided */
if (devname) {
if (devname[0] != '\0') {
int i = 0;
while (available_devices[i] != NULL) {
if (!strcasecmp(available_devices[i]->name, devname)) {
rf->dev = available_devices[i];
return available_devices[i]->srsran_rf_open_multi(args, &rf->handler, nof_channels);
}
i++;
// Try to open the device if name is provided
if (devname && devname[0] != '\0') {
int i = 0;
while (available_devices[i] != NULL) {
if (!strcasecmp(available_devices[i]->name, devname)) {
rf->dev = available_devices[i];
return available_devices[i]->srsran_rf_open_multi(args, &rf->handler, nof_channels);
}
printf("Device %s not found. Switching to auto mode\n", devname);
i++;
}
}
/* If in auto mode or provided device not found, 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 0;
// 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++;
}
i++;
}
ERROR("No compatible RF frontend found");
return -1;
return SRSRAN_ERROR;
}
const char* srsran_rf_name(srsran_rf_t* rf)

Loading…
Cancel
Save