Allow NULL args in rf_open()

master
ismagom 9 years ago
parent cafb8e1ab0
commit bfd6fca7d0

@ -185,7 +185,7 @@ int rf_blade_open(char *args, void **h)
*h = handler;
printf("Opening bladeRF...\n");
int status = bladerf_open(&handler->dev, NULL);
int status = bladerf_open(&handler->dev, args);
if (status) {
fprintf(stderr, "Unable to open device: %s\n", bladerf_strerror(status));
return status;

@ -101,6 +101,7 @@ const char* srslte_rf_get_devname(srslte_rf_t *rf) {
int srslte_rf_open_devname(srslte_rf_t *rf, char *devname, char *args) {
/* Try to open the device if name is provided */
if (devname) {
if (devname[0] != '\0') {
int i=0;
while(available_devices[i] != NULL) {
if (!strcmp(available_devices[i]->name, devname)) {
@ -111,6 +112,7 @@ int srslte_rf_open_devname(srslte_rf_t *rf, char *devname, char *args) {
}
printf("Device %s not found. Switching to auto mode\n", devname);
}
}
/* If in auto mode or provided device not found, try to open in order of apperance in available_devices[] array */
int i=0;

@ -204,6 +204,7 @@ float rf_uhd_get_rssi(void *h) {
int rf_uhd_open(char *args, void **h)
{
if (h) {
*h = NULL;
rf_uhd_handler_t *handler = (rf_uhd_handler_t*) malloc(sizeof(rf_uhd_handler_t));
@ -221,6 +222,11 @@ int rf_uhd_open(char *args, void **h)
uhd_string_vector_make(&devices_str);
uhd_usrp_find("", &devices_str);
// Allow NULL parameter
if (args == NULL) {
args = "";
}
/* If device type or name not given in args, choose a B200 */
if (args[0]=='\0') {
// If B200 is available, use it
@ -294,6 +300,9 @@ int rf_uhd_open(char *args, void **h)
}
return 0;
} else {
return SRSLTE_ERROR_INVALID_INPUTS;
}
}

Loading…
Cancel
Save