Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix adrv9002 plugin #470

Merged
merged 4 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion glade/adrv9002.glade
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@
</packing>
</child>
<child>
<object class="GtkFrame" id="frame6">
<object class="GtkFrame" id="frame_calibrations">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">15</property>
Expand Down
11 changes: 11 additions & 0 deletions iio_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
1 change: 1 addition & 0 deletions iio_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__ */
2 changes: 1 addition & 1 deletion osc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
8 changes: 7 additions & 1 deletion plugins/adrv9002.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down