X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=toolbar.c;h=5a056ffe4949f6b7818b5a66a0fb2619a19cd827;hb=3b7d0166b30bc7602ff16ed39f212ecdabd7346e;hp=3871dd61d1a3afcb80f4461f640f50f797fef884;hpb=ffe80b55222c3f7e0ac6956082e365e3f81cdecf;p=sigrok-gtk.git diff --git a/toolbar.c b/toolbar.c index 3871dd6..5a056ff 100644 --- a/toolbar.c +++ b/toolbar.c @@ -28,7 +28,7 @@ #include "sigrok-gtk.h" enum { - DEV_PROP_CAPABILITY, + DEV_PROP_HWCAP, DEV_PROP_TYPE, DEV_PROP_SHORTNAME, DEV_PROP_DESCRIPTION, @@ -51,7 +51,7 @@ static void prop_edited(GtkCellRendererText *cel, gchar *path, gchar *text, gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(props), &iter, path); gtk_tree_model_get(GTK_TREE_MODEL(props), &iter, - DEV_PROP_CAPABILITY, &cap, + DEV_PROP_HWCAP, &cap, DEV_PROP_TYPE, &type, -1); switch (type) { @@ -59,12 +59,11 @@ static void prop_edited(GtkCellRendererText *cel, gchar *path, gchar *text, if (sr_parse_sizestring(text, &tmp_u64) != SR_OK) return; - ret = dev->plugin->set_configuration(dev->plugin_index, - cap, &tmp_u64); + ret = dev->plugin->dev_config_set(dev->plugin_index, + cap, &tmp_u64); break; case SR_T_CHAR: - ret = dev->plugin->set_configuration(dev->plugin_index, - cap, text); + ret = dev->plugin->dev_config_set(dev->plugin_index, cap, text); break; /* SR_T_BOOL will be handled by prop_toggled */ } @@ -83,12 +82,12 @@ static void prop_toggled(GtkCellRendererToggle *cel, gchar *path, gboolean val; gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(props), &iter, path); gtk_tree_model_get(GTK_TREE_MODEL(props), &iter, - DEV_PROP_CAPABILITY, &cap, + DEV_PROP_HWCAP, &cap, DEV_PROP_TYPE, &type, -1); val = !gtk_cell_renderer_toggle_get_active(cel); - ret = dev->plugin->set_configuration(dev->plugin_index, cap, - GINT_TO_POINTER(val)); + ret = dev->plugin->dev_config_set(dev->plugin_index, cap, + GINT_TO_POINTER(val)); if (!ret) gtk_list_store_set(props, &iter, DEV_PROP_BOOLVALUE, val, -1); @@ -138,16 +137,16 @@ static void dev_set_options(GtkAction *action, GtkWindow *parent) G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_BOOLEAN); gtk_tree_view_set_model(GTK_TREE_VIEW(tv), GTK_TREE_MODEL(props)); - int *capabilities = dev->plugin->get_capabilities(); + int *hwcaps = dev->plugin->hwcap_get_all(); int cap; GtkTreeIter iter; - for (cap = 0; capabilities[cap]; cap++) { + for (cap = 0; hwcaps[cap]; cap++) { struct sr_hwcap_option *hwo; - if (!(hwo = sr_hw_hwcap_get(capabilities[cap]))) + if (!(hwo = sr_hw_hwcap_get(hwcaps[cap]))) continue; gtk_list_store_append(props, &iter); gtk_list_store_set(props, &iter, - DEV_PROP_CAPABILITY, capabilities[cap], + DEV_PROP_HWCAP, hwcaps[cap], DEV_PROP_TYPE, hwo->type, DEV_PROP_SHORTNAME, hwo->shortname, DEV_PROP_DESCRIPTION, hwo->description, @@ -355,7 +354,7 @@ static void capture_run(GtkAction *action, GObject *parent) if (time_msec) { if (sr_hw_has_hwcap(dev->plugin, SR_HWCAP_LIMIT_MSEC)) { - if (dev->plugin->set_configuration(dev->plugin_index, + if (dev->plugin->dev_config_set(dev->plugin_index, SR_HWCAP_LIMIT_MSEC, &time_msec) != SR_OK) { g_critical("Failed to configure time limit."); @@ -369,7 +368,7 @@ static void capture_run(GtkAction *action, GObject *parent) limit_samples = 0; if (sr_dev_has_hwcap(dev, SR_HWCAP_SAMPLERATE)) { guint64 tmp_u64; - tmp_u64 = *((uint64_t *)dev->plugin->get_dev_info( + tmp_u64 = *((uint64_t *)dev->plugin->dev_info_get( dev->plugin_index, SR_DI_CUR_SAMPLERATE)); limit_samples = tmp_u64 * time_msec / (uint64_t) 1000; @@ -379,7 +378,7 @@ static void capture_run(GtkAction *action, GObject *parent) return; } - if (dev->plugin->set_configuration(dev->plugin_index, + if (dev->plugin->dev_config_set(dev->plugin_index, SR_HWCAP_LIMIT_SAMPLES, &limit_samples) != SR_OK) { g_critical("Failed to configure time-based sample limit."); @@ -388,7 +387,7 @@ static void capture_run(GtkAction *action, GObject *parent) } } if (limit_samples) { - if (dev->plugin->set_configuration(dev->plugin_index, + if (dev->plugin->dev_config_set(dev->plugin_index, SR_HWCAP_LIMIT_SAMPLES, &limit_samples) != SR_OK) { g_critical("Failed to configure sample limit."); @@ -396,8 +395,8 @@ static void capture_run(GtkAction *action, GObject *parent) } } - if (dev->plugin->set_configuration(dev->plugin_index, - SR_HWCAP_PROBECONFIG, (char *)dev->probes) != SR_OK) { + if (dev->plugin->dev_config_set(dev->plugin_index, + SR_HWCAP_PROBECONFIG, (char *)dev->probes) != SR_OK) { printf("Failed to configure probes.\n"); sr_session_destroy(); return;