]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
SOAPY fixes.
authorc vw <dl1ycf@darc.de>
Tue, 31 Mar 2020 09:54:08 +0000 (11:54 +0200)
committerc vw <dl1ycf@darc.de>
Tue, 31 Mar 2020 09:54:08 +0000 (11:54 +0200)
ant_menu.c
discovery.c
radio.c
radio_menu.c
receiver.c
rigctl.c

index be686d78bed504db220a85161459b45e9ddbe9ff..97139957267a767424f0cdf7e8b7fc2787924477 100644 (file)
@@ -77,7 +77,7 @@ static void adc0_antenna_cb(GtkComboBox *widget,gpointer data) {
   if(radio->protocol==NEW_PROTOCOL) {
     schedule_high_priority();
 #ifdef SOAPYSDR
-  } else if(radio->device==SOAPYSDR_USB_DEVICE) {
+  } else if(radio->protocol == SOAPYSDR_PROTOCOL && radio->device==SOAPYSDR_USB_DEVICE) {
     soapy_protocol_set_rx_antenna(receiver[0],adc[0].antenna);
 #endif
   }
@@ -89,7 +89,7 @@ static void dac0_antenna_cb(GtkComboBox *widget,gpointer data) {
   if(radio->protocol==NEW_PROTOCOL) {
     schedule_high_priority();
 #ifdef SOAPYSDR
-  } else if(radio->device==SOAPYSDR_USB_DEVICE) {
+  } else if(radio->protocol == SOAPYSDR_PROTOCOL && radio->device==SOAPYSDR_USB_DEVICE) {
     soapy_protocol_set_tx_antenna(transmitter,dac->antenna);
 #endif
   }
@@ -331,7 +331,7 @@ void ant_menu(GtkWidget *parent) {
   gtk_grid_attach(GTK_GRID(grid),close_b,0,0,1,1);
 
 #ifdef SOAPYSDR
-  if(radio->device!=SOAPYSDR_USB_DEVICE) {
+  if(radio->protocol != SOAPYSDR_PROTOCOL || radio->device!=SOAPYSDR_USB_DEVICE) {
 #endif
     GtkWidget *hf_rb=gtk_radio_button_new_with_label(NULL,"HF");
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hf_rb),TRUE);
@@ -432,7 +432,7 @@ void ant_menu(GtkWidget *parent) {
   }
 
 #ifdef SOAPYSDR
-  if(radio->device==SOAPYSDR_USB_DEVICE) {
+  if(radio->protocol == SOAPYSDR_PROTOCOL && radio->device==SOAPYSDR_USB_DEVICE) {
     int i;
 
 g_print("rx_antennas=%ld\n",radio->info.soapy.rx_antennas);
index 64973ecc20d3062f3b6190dec101b7020b7a7aa8..d46ec19b623882011bf30b28fa3b2412e880b94d 100644 (file)
@@ -490,7 +490,7 @@ fprintf(stderr,"%p Protocol=%d name=%s\n",d,d->protocol,d->name);
       }
 
 #ifdef SOAPYSDR
-      if(d->device!=SOAPYSDR_USB_DEVICE) {
+      if(d->protocol != SOAPYSDR_PROTOCOL || d->device!=SOAPYSDR_USB_DEVICE) {
 #endif
         // if not on the same subnet then cannot start it
         if((d->info.network.interface_address.sin_addr.s_addr&d->info.network.interface_netmask.sin_addr.s_addr) != (d->info.network.address.sin_addr.s_addr&d->info.network.interface_netmask.sin_addr.s_addr)) {
diff --git a/radio.c b/radio.c
index 19f6698862843dee9acadf5bf2b344a61839da48..8e97e4ca7717573cbbe4b596de6e383859348c1e 100644 (file)
--- a/radio.c
+++ b/radio.c
@@ -857,7 +857,7 @@ void start_radio() {
   iqswap=0;
 
 #ifdef SOAPYSDR
-  if(device==SOAPYSDR_USB_DEVICE) {
+  if(protocol == SOAPYSDR_PROTOCOL && device==SOAPYSDR_USB_DEVICE) {
     iqswap=1;
     receivers=1;
   }
@@ -880,17 +880,19 @@ void start_radio() {
   adc[0].preamp=FALSE;
   adc[0].attenuation=0;
 #ifdef SOAPYSDR
-  adc[0].antenna=0;
-  if(device==SOAPYSDR_USB_DEVICE) {
-    adc[0].rx_gain=malloc(radio->info.soapy.rx_gains*sizeof(gint));
-    for (size_t i = 0; i < radio->info.soapy.rx_gains; i++) {
-      adc[0].rx_gain[i]=0;
-    }
-    adc[0].agc=FALSE;
-    dac[0].antenna=1;
-    dac[0].tx_gain=malloc(radio->info.soapy.tx_gains*sizeof(gint));
-    for (size_t i = 0; i < radio->info.soapy.tx_gains; i++) {
-      dac[0].tx_gain[i]=0;
+  if (protocol == SOAPYSDR_PROTOCOL) {
+    adc[0].antenna=0;
+    if(device==SOAPYSDR_USB_DEVICE) {
+      adc[0].rx_gain=malloc(radio->info.soapy.rx_gains*sizeof(gint));
+      for (size_t i = 0; i < radio->info.soapy.rx_gains; i++) {
+        adc[0].rx_gain[i]=0;
+      }
+      adc[0].agc=FALSE;
+      dac[0].antenna=1;
+      dac[0].tx_gain=malloc(radio->info.soapy.tx_gains*sizeof(gint));
+      for (size_t i = 0; i < radio->info.soapy.tx_gains; i++) {
+        dac[0].tx_gain[i]=0;
+      }
     }
   }
 #endif
@@ -904,21 +906,23 @@ void start_radio() {
   adc[1].preamp=FALSE;
   adc[1].attenuation=0;
 #ifdef SOAPYSDR
-  adc[1].antenna=0;
-  if(device==SOAPYSDR_USB_DEVICE) {
-    adc[1].rx_gain=malloc(radio->info.soapy.rx_gains*sizeof(gint));
-    for (size_t i = 0; i < radio->info.soapy.rx_gains; i++) {
-      adc[1].rx_gain[i]=0;
-    }
-    adc[1].agc=FALSE;
+  if (protocol == SOAPYSDR_PROTOCOL) {
+    adc[1].antenna=0;
+    if(device==SOAPYSDR_USB_DEVICE) {
+      adc[1].rx_gain=malloc(radio->info.soapy.rx_gains*sizeof(gint));
+      for (size_t i = 0; i < radio->info.soapy.rx_gains; i++) {
+        adc[1].rx_gain[i]=0;
+      }
+      adc[1].agc=FALSE;
 
-    dac[1].tx_gain=malloc(radio->info.soapy.tx_gains*sizeof(gint));
-    for (size_t i = 0; i < radio->info.soapy.tx_gains; i++) {
-      dac[1].tx_gain[i]=0;
+      dac[1].tx_gain=malloc(radio->info.soapy.tx_gains*sizeof(gint));
+      for (size_t i = 0; i < radio->info.soapy.tx_gains; i++) {
+        dac[1].tx_gain[i]=0;
+      }
     }
-  }
 
-  radio_sample_rate=radio->info.soapy.sample_rate;
+    radio_sample_rate=radio->info.soapy.sample_rate;
+  }
 #endif
 
 //g_print("meter_calibration=%f display_calibration=%f\n", meter_calibration, display_calibration);
@@ -2013,7 +2017,7 @@ g_print("radioRestoreState: %s\n",property_path);
     if(value) mute_rx_while_transmitting=atoi(value);
 
 #ifdef SOAPYSDR
-  if(device==SOAPYSDR_USB_DEVICE) {
+  if(protocol == SOAPYSDR_PROTOCOL && device==SOAPYSDR_USB_DEVICE) {
     char name[128];
     for(int i=0;i<radio->info.soapy.rx_gains;i++) {
       sprintf(name,"radio.adc[0].rx_gain.%s",radio->info.soapy.rx_gain[i]) ;
@@ -2237,7 +2241,7 @@ g_print("radioSaveState: %s\n",property_path);
     setProperty("rx_gain_calibration",value);
 
 #ifdef SOAPYSDR
-    if(device==SOAPYSDR_USB_DEVICE) {
+    if(protocol == SOAPYSDR_PROTOCOL && device==SOAPYSDR_USB_DEVICE) {
       char name[128];
       for(int i=0;i<radio->info.soapy.rx_gains;i++) {
         sprintf(name,"radio.adc[0].rx_gain.%s",radio->info.soapy.rx_gain[i]);
index db99059360ea23da2956f8fda3e62b77cc057578..7db3620475fb2a34fee718c02fb8cb99935d1188 100644 (file)
@@ -80,7 +80,7 @@ static void rf_gain_value_changed_cb(GtkWidget *widget, gpointer data) {
   ADC *adc=(ADC *)data;
   active_receiver->rf_gain=gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget));
   
-  if(radio->device==SOAPYSDR_USB_DEVICE) {
+  if(radio->protocol == SOAPYSDR_PROTOCOL && radio->device==SOAPYSDR_USB_DEVICE) {
     soapy_protocol_set_gain(receiver[0],active_receiver->rf_gain);
   }
 
@@ -96,7 +96,7 @@ static void rf_gain_value_changed_cb(GtkWidget *widget, gpointer data) {
 static void rx_gain_value_changed_cb(GtkWidget *widget, gpointer data) {
   ADC *adc=(ADC *)data;
   int gain;
-  if(radio->device==SOAPYSDR_USB_DEVICE) {
+  if(radio->protocol == SOAPYSDR_PROTOCOL && radio->device==SOAPYSDR_USB_DEVICE) {
     gain=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
     soapy_protocol_set_gain_element(receiver[0],(char *)gtk_widget_get_name(widget),gain);
 
@@ -114,7 +114,7 @@ static void rx_gain_value_changed_cb(GtkWidget *widget, gpointer data) {
 
 static void drive_gain_value_changed_cb(GtkWidget *widget, gpointer data) {
   DAC *dac=(DAC *)data;
-  if(radio->device==SOAPYSDR_USB_DEVICE) {
+  if(radio->protocol == SOAPYSDR_PROTOCOL && radio->device==SOAPYSDR_USB_DEVICE) {
     transmitter->drive=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
     soapy_protocol_set_tx_gain(transmitter,(double)transmitter->drive);
 /*
@@ -129,7 +129,7 @@ static void drive_gain_value_changed_cb(GtkWidget *widget, gpointer data) {
 static void tx_gain_value_changed_cb(GtkWidget *widget, gpointer data) {
   DAC *dac=(DAC *)data;
   int gain;
-  if(radio->device==SOAPYSDR_USB_DEVICE) {
+  if(radio->protocol == SOAPYSDR_PROTOCOL && radio->device==SOAPYSDR_USB_DEVICE) {
     gain=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
     soapy_protocol_set_tx_gain_element(transmitter,(char *)gtk_widget_get_name(widget),gain);
 /*
@@ -154,7 +154,7 @@ static void agc_changed_cb(GtkWidget *widget, gpointer data) {
 static void dac0_gain_value_changed_cb(GtkWidget *widget, gpointer data) {
   DAC *dac=(DAC *)data;
   int gain;
-  if(radio->device==SOAPYSDR_USB_DEVICE) {
+  if(radio->protocol == SOAPYSDR_PROTOCOL && radio->device==SOAPYSDR_USB_DEVICE) {
     gain=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
     soapy_protocol_set_tx_gain_element(radio->transmitter,(char *)gtk_widget_get_name(widget),gain);
     for(int i=0;i<radio->discovered->info.soapy.tx_gains;i++) {
@@ -778,7 +778,7 @@ void radio_menu(GtkWidget *parent) {
 
 #ifdef SOAPYSDR
   col=0;
-  if(radio->device==SOAPYSDR_USB_DEVICE) {
+  if(radio->protocol == SOAPYSDR_PROTOCOL && radio->device==SOAPYSDR_USB_DEVICE) {
     int i;
 /*
     if(radio->info.soapy.rx_gains>0) {
index 8ae57f208a8212885fd3d968fd7a705b6777099c..1ff8c4b869941eb33d4d5c70c0d701ad0c6a6634 100644 (file)
@@ -916,7 +916,7 @@ fprintf(stderr,"create_receiver: id=%d buffer_size=%d fft_size=%d pixels=%d fps=
   }
 fprintf(stderr,"create_receiver: id=%d default adc=%d\n",rx->id, rx->adc);
 #ifdef SOAPYSDR
-  if(radio->device==SOAPYSDR_USB_DEVICE) {
+  if(radio->protocol == SOAPYSDR_PROTOCOL && radio->device==SOAPYSDR_USB_DEVICE) {
     rx->sample_rate=radio->info.soapy.sample_rate;
     rx->resampler=NULL;
     rx->resample_buffer=NULL;
index 21529146a60a4b6c0fd3820034f5163ee50708d6..e55d2265103f1a3c4d670d6917595e58ba2c3c90 100644 (file)
--- a/rigctl.c
+++ b/rigctl.c
@@ -1165,10 +1165,9 @@ void parse_cmd ( char * cmd_input,int len,int client_sock) {
                                              fprintf(stderr,"RIGCTL: BD - current band=%d\n",cur_band);
                                              #endif
                                              if(cur_band == 0) {
+                                                cur_band = band6;
                                                 #ifdef SOAPYSDR
-                                                    cur_band = band472;
-                                                #else
-                                                    cur_band = band6;
+                                                    if (radio->protocol == SOAPYSDR_PROTOCOL) cur_band = band472;
                                                 #endif
                                              } else {
                                                 --cur_band;