X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=blobdiff_plain;f=src%2Foutput%2Fsrzip.c;h=ae066cde228b4f66a240458cf0f803281b0e6db4;hp=a82113fa5082fec8c40d23ebcfbb86e2512d7600;hb=c1aae90038456a61d0f9313d34e6107c3440d3e7;hpb=bc96d5f08fe59ea7c51799b148946f5003c90927 diff --git a/src/output/srzip.c b/src/output/srzip.c index a82113fa..ae066cde 100644 --- a/src/output/srzip.c +++ b/src/output/srzip.c @@ -24,7 +24,7 @@ #include #include #include -#include "libsigrok.h" +#include #include "libsigrok-internal.h" #define LOG_PREFIX "output/srzip" @@ -39,11 +39,16 @@ static int init(struct sr_output *o, GHashTable *options) { struct out_context *outc; + (void)options; + + if (strlen(o->filename) == 0) { + sr_info("srzip output module requires a file name, cannot save."); + return SR_ERR_ARG; + } + outc = g_malloc0(sizeof(struct out_context)); + outc->filename = g_strdup(o->filename); o->priv = outc; - outc->filename = g_strdup(g_variant_get_string(g_hash_table_lookup(options, "filename"), NULL)); - if (strlen(outc->filename) == 0) - return SR_ERR_ARG; return SR_OK; } @@ -102,6 +107,8 @@ static int zip_create(const struct sr_output *o) ch = l->data; if (ch->type != SR_CHANNEL_LOGIC) continue; + if (!ch->enabled) + continue; fprintf(meta, "probe%d = %s\n", ch->index + 1, ch->name); } fclose(meta); @@ -294,7 +301,6 @@ static int cleanup(struct sr_output *o) } static struct sr_option options[] = { - { "filename", "Filename", "File to write", NULL, NULL }, ALL_ZERO }; @@ -310,9 +316,10 @@ SR_PRIV struct sr_output_module output_srzip = { .id = "srzip", .name = "srzip", .desc = "srzip session file", + .exts = (const char*[]){"sr", NULL}, + .flags = SR_OUTPUT_INTERNAL_IO_HANDLING, .options = get_options, .init = init, .receive = receive, .cleanup = cleanup, }; -