#include <stdlib.h>
#include <string.h>
#include <glib.h>
-#include <sigrok.h>
+#include "sigrok.h"
+#include "sigrok-internal.h"
#include "config.h"
struct context {
unsigned int unitsize;
};
-
static int init(struct sr_output *o)
{
struct context *ctx;
struct sr_probe *probe;
GSList *l;
uint64_t samplerate;
- int num_enabled_probes, i;
+ int num_enabled_probes;
- if (!(ctx = g_malloc(sizeof(struct context))))
+ if (!(ctx = g_try_malloc(sizeof(struct context)))) {
+ sr_err("ols out: %s: ctx malloc failed", __func__);
return SR_ERR_MALLOC;
+ }
o->internal = ctx;
ctx->num_samples = 0;
g_string_append_printf(ctx->header, ";EnabledChannels: -1\n");
g_string_append_printf(ctx->header, ";Compressed: true\n");
g_string_append_printf(ctx->header, ";CursorEnabled: false\n");
- for (i = 0; i < 10; i++)
- g_string_append_printf(ctx->header, ";Cursor%d: 0\n", i);
return SR_OK;
}
}
struct sr_output_format output_ols = {
- "ols",
- "OpenBench Logic Sniffer",
- SR_DF_LOGIC,
- init,
- data,
- event,
+ .id = "ols",
+ .description = "OpenBench Logic Sniffer",
+ .df_type = SR_DF_LOGIC,
+ .init = init,
+ .data = data,
+ .event = event,
};