diff --git a/lib/include/srslte/phy/rf/rf.h b/lib/include/srslte/phy/rf/rf.h index 6aaed5e01..a9b0d93c6 100644 --- a/lib/include/srslte/phy/rf/rf.h +++ b/lib/include/srslte/phy/rf/rf.h @@ -69,7 +69,7 @@ SRSLTE_API int srslte_rf_open(srslte_rf_t* h, char* args); SRSLTE_API int srslte_rf_open_multi(srslte_rf_t* h, char* args, uint32_t nof_channels); -SRSLTE_API int srslte_rf_open_devname(srslte_rf_t* h, char* devname, char* args, uint32_t nof_channels); +SRSLTE_API int srslte_rf_open_devname(srslte_rf_t* h, const char* devname, char* args, uint32_t nof_channels); SRSLTE_API const char* srslte_rf_name(srslte_rf_t* h); diff --git a/lib/include/srslte/radio/radio.h b/lib/include/srslte/radio/radio.h index cf173f709..674aaffd8 100644 --- a/lib/include/srslte/radio/radio.h +++ b/lib/include/srslte/radio/radio.h @@ -74,7 +74,7 @@ public: } } - bool init(log_filter* _log_h, char* args = NULL, char* devname = NULL, uint32_t nof_channels = 1); + bool init(log_filter* _log_h, const char* args = NULL, char* devname = NULL, uint32_t nof_channels = 1); void stop(); void reset(); bool start_agc(bool tx_gain_same_rx = false); diff --git a/lib/src/phy/rf/rf_imp.c b/lib/src/phy/rf/rf_imp.c index ed4113220..460505b64 100644 --- a/lib/src/phy/rf/rf_imp.c +++ b/lib/src/phy/rf/rf_imp.c @@ -100,7 +100,7 @@ const char* srslte_rf_get_devname(srslte_rf_t* rf) return ((rf_dev_t*)rf->dev)->name; } -int srslte_rf_open_devname(srslte_rf_t* rf, char* devname, char* args, uint32_t nof_channels) +int srslte_rf_open_devname(srslte_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 */ diff --git a/lib/src/radio/radio.cc b/lib/src/radio/radio.cc index ca4e05741..e83049f18 100644 --- a/lib/src/radio/radio.cc +++ b/lib/src/radio/radio.cc @@ -30,9 +30,11 @@ extern "C" { namespace srslte { -bool radio::init(log_filter* _log_h, char* args, char* devname, uint32_t nof_channels) +bool radio::init(log_filter* _log_h, const char* args, char* devname, uint32_t nof_channels) { - if (srslte_rf_open_devname(&rf_device, devname, args, nof_channels)) { + std::vector tmp_args(strlen(args) + 1); + strcpy(&tmp_args[0], args); + if (srslte_rf_open_devname(&rf_device, devname, &tmp_args[0], nof_channels)) { ERROR("Error opening RF device\n"); return false; } diff --git a/lib/src/radio/radio_multi.cc b/lib/src/radio/radio_multi.cc index 1af4dee02..7183835a9 100644 --- a/lib/src/radio/radio_multi.cc +++ b/lib/src/radio/radio_multi.cc @@ -63,10 +63,10 @@ int radio_multi::init(const rf_args_t& args_, phy_interface_radio* phy_) dev_name = (char*)args.device_name.c_str(); } - char* dev_args[SRSLTE_MAX_RADIOS] = {nullptr}; + const char* dev_args[SRSLTE_MAX_RADIOS] = {nullptr}; for (int i = 0; i < SRSLTE_MAX_RADIOS; i++) { if (args.device_args[i] != "auto") { - dev_args[i] = (char*)args.device_args[i].c_str(); + dev_args[i] = args.device_args[i].c_str(); } }