diff --git a/lib/src/phy/rf/rf_soapy_imp.c b/lib/src/phy/rf/rf_soapy_imp.c index 7421275b5..d067e6787 100644 --- a/lib/src/phy/rf/rf_soapy_imp.c +++ b/lib/src/phy/rf/rf_soapy_imp.c @@ -97,7 +97,11 @@ char* rf_soapy_devname(void* h) bool rf_soapy_rx_wait_lo_locked(void *h) { - printf("TODO: implement rf_soapy_rx_wait_lo_locked()\n"); + rf_soapy_handler_t *handler = (rf_soapy_handler_t*)h; + char *ret = SoapySDRDevice_readChannelSensor(handler->device, SOAPY_SDR_RX, 0, "lo_locked"); + if (ret != NULL) { + return (strcmp(ret, "true") == 0 ? true : false); + } return true; } @@ -212,7 +216,7 @@ int rf_soapy_open_multi(char *args, void **h, uint32_t nof_rx_antennas) SoapySDRDevice *sdr = SoapySDRDevice_make(&(soapy_args[0])); if (sdr == NULL) { - printf("failed to create SOAPY object\n"); + printf("Failed to create Soapy object\n"); return SRSLTE_ERROR; } @@ -225,7 +229,7 @@ int rf_soapy_open_multi(char *args, void **h, uint32_t nof_rx_antennas) handler->rx_stream_active = false; handler->devname = devname; if(SoapySDRDevice_getNumChannels(handler->device,SOAPY_SDR_RX) > 0){ - printf("setting up RX stream\n"); + printf("Setting up RX stream\n"); if(SoapySDRDevice_setupStream(handler->device, &(handler->rxStream), SOAPY_SDR_RX, SOAPY_SDR_CF32, NULL, 0, NULL) != 0) { printf("Rx setupStream fail: %s\n", SoapySDRDevice_lastError()); return SRSLTE_ERROR; @@ -233,19 +237,27 @@ int rf_soapy_open_multi(char *args, void **h, uint32_t nof_rx_antennas) } if(SoapySDRDevice_getNumChannels(handler->device,SOAPY_SDR_TX) > 0){ - printf("setting up TX stream\n"); + printf("Setting up TX stream\n"); if (SoapySDRDevice_setupStream(handler->device, &(handler->txStream), SOAPY_SDR_TX, SOAPY_SDR_CF32, NULL, 0, NULL) != 0) { printf("Tx setupStream fail: %s\n", SoapySDRDevice_lastError()); return SRSLTE_ERROR; } } + + // list device sensors size_t sensor_length; char** sensors; sensors = SoapySDRDevice_listSensors(handler->device, &sensor_length); - for(int i = 0; i < sensor_length;i++) - { - printf("available sensors are : \n"); - puts(sensors[i]); + printf("Available device sensors: \n"); + for(int i = 0; i < sensor_length; i++) { + printf(" - %s\n", sensors[i]); + } + + // list channel sensors + sensors = SoapySDRDevice_listChannelSensors(handler->device, SOAPY_SDR_RX, 0, &sensor_length); + printf("Available sensors for RX channel 0: \n"); + for(int i = 0; i < sensor_length; i++) { + printf(" - %s\n", sensors[i]); } return SRSLTE_SUCCESS;