* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <config.h>
#include <glib.h>
#include <glib/gstdio.h>
#include <string.h>
double tmp_double, dlow, dhigh;
uint64_t tmp_u64, p, q, low, high, mqflags;
uint32_t mq;
- GVariant *rational[2], *range[2], *gvar, *gtup[2];
+ GVariant *rational[2], *range[2], *gtup[2];
GVariantBuilder *vbl;
gboolean tmp_bool;
gchar **keyval;
g_strfreev(keyval);
}
break;
- case SR_T_MQLIST:
+ case SR_T_MQ:
/*
Argument is MQ id e.g. ("voltage") optionally followed by one
or more /<mqflag> e.g. "/ac".
}
g_strfreev(keyval);
if (ret != -1) {
- vbl = g_variant_builder_new(G_VARIANT_TYPE_ARRAY);
gtup[0] = g_variant_new_uint32(mq);
gtup[1] = g_variant_new_uint64(mqflags);
- gvar = g_variant_new_tuple(gtup, 2);
- g_variant_builder_add_value(vbl, gvar);
- src->data = g_variant_builder_end(vbl);
+ src->data = g_variant_new_tuple(gtup, 2);
}
break;
default:
int is_demo_dev;
struct sr_dev_driver *driver;
const struct sr_transform *t;
+ GMainLoop *main_loop;
devices = device_scan();
if (!devices) {
return;
}
+ trigger = NULL;
if (opt_triggers) {
if (!parse_triggerstring(sdi, opt_triggers, &trigger)) {
sr_session_destroy(session);
if (!(t = setup_transform_module(sdi)))
g_critical("Failed to initialize transform module.");
+ main_loop = g_main_loop_new(NULL, FALSE);
+
+ sr_session_stopped_callback_set(session,
+ (sr_session_stopped_callback)g_main_loop_quit, main_loop);
+
if (sr_session_start(session) != SR_OK) {
g_critical("Failed to start session.");
+ g_main_loop_unref(main_loop);
sr_session_destroy(session);
return;
}
if (opt_continuous)
add_anykey(session);
- sr_session_run(session);
+ g_main_loop_run(main_loop);
if (opt_continuous)
clear_anykey();
+ if (trigger)
+ sr_trigger_free(trigger);
+
sr_session_datafeed_callback_remove_all(session);
+ g_main_loop_unref(main_loop);
sr_session_destroy(session);
-
}