diff --git a/glade/adrv9002.glade b/glade/adrv9002.glade index b794a537..9f70f7cd 100644 --- a/glade/adrv9002.glade +++ b/glade/adrv9002.glade @@ -434,7 +434,7 @@ - + True False 15 diff --git a/iio_utils.c b/iio_utils.c index f7ecb9b4..a4baa330 100644 --- a/iio_utils.c +++ b/iio_utils.c @@ -151,3 +151,14 @@ const char *get_iio_device_label_or_name(const struct iio_device *dev) return iio_device_get_name(dev); } + +bool iio_attr_not_found(struct iio_device *dev, struct iio_channel *chn, const char *attr_name) +{ + if (!attr_name || !dev) + return false; + + if (!chn) + return !iio_device_find_attr(dev, attr_name); + + return !iio_channel_find_attr(chn, attr_name); +} diff --git a/iio_utils.h b/iio_utils.h index 9466b1a7..f78ecd7f 100644 --- a/iio_utils.h +++ b/iio_utils.h @@ -24,5 +24,6 @@ int str_natural_cmp(const char *s1, const char *s2); void handle_toggle_section_cb(struct _GtkToggleToolButton *btn, struct _GtkWidget *section); const char *get_iio_device_label_or_name(const struct iio_device *dev); +bool iio_attr_not_found(struct iio_device *dev, struct iio_channel *chn, const char *attr_name); #endif /* __IIO_UTILS__ */ diff --git a/osc.c b/osc.c index dcfcc540..42d924c9 100644 --- a/osc.c +++ b/osc.c @@ -2897,7 +2897,7 @@ int osc_load_glade_file(GtkBuilder *builder, const char *fname) snprintf(path, sizeof(path), OSC_GLADE_FILE_PATH "%s.glade", fname); if (gtk_builder_add_from_file(builder, path, NULL)) return 0; - fprintf(stderr, "Could not find '%s.glade' file", fname); + fprintf(stderr, "Could not find/load '%s.glade' file\n", fname); return -1; } diff --git a/plugins/adrv9002.c b/plugins/adrv9002.c index 4fa6e332..885d7c4f 100644 --- a/plugins/adrv9002.c +++ b/plugins/adrv9002.c @@ -2838,7 +2838,13 @@ static void adrv9002_initial_calibrations_init(struct plugin_private *priv) GObject *help = gtk_builder_get_object(priv->builder, "initial_calibrations_help"); int n_w = priv->num_widgets; - /* initial calibrations */ + if (iio_attr_not_found(priv->adrv9002, NULL, "initial_calibrations")) { + GObject *init_frame = gtk_builder_get_object(priv->builder, "frame_calibrations"); + + gtk_widget_hide(GTK_WIDGET(init_frame)); + return; + } + adrv9002_combo_box_init(&priv->device_w[priv->num_widgets++], "initial_calibrations", "initial_calibrations", "initial_calibrations_available", priv, NULL);