- o->device->plugin_index, DI_CUR_SAMPLERATE));
- if (!(frequency_s = sigrok_samplerate_string(samplerate))) {
- free(ctx->header);
- free(ctx);
- return SIGROK_ERR;
- }
- snprintf(comment, 127, ols_header_comment,
- ctx->num_enabled_probes, num_probes, frequency_s);
- free(frequency_s);
- }
-
- /* Columns / channels */
- wbuf[0] = '\0';
- for (i = 0; i < ctx->num_enabled_probes; i++) {
- c = (char *)&wbuf + strlen((char *)&wbuf);
- sprintf(c, "# %d\t\t%s\n", i + 1, ctx->probelist[i]);
- }
-
- if (!(frequency_s = sigrok_period_string(samplerate))) {
- free(ctx->header);
- free(ctx);
- return SIGROK_ERR;
- }
-
- t = time(NULL);
-
- /* TODO: Special handling for the demo driver. */
- /* TODO: Don't hardcode numsamples! */
- /* TODO: Check if num_enabled_probes/channels setting is correct. */
- b = snprintf(ctx->header, MAX_HEADER_LEN, OLS_HEADER,
- PACKAGE_STRING, ctime(&t),
- comment,
- (const char *)&wbuf,
- (uint64_t)10000 /* numsamples */,
- samplerate,
- ctx->num_enabled_probes,
- (uint64_t)10000 /* numsamples */);
-
- /* TODO: Yield errors on stuff the OLS format doesn't support. */
-
- free(frequency_s);
-
- if (b < 0) {
- free(ctx->header);
- free(ctx);
- return SIGROK_ERR;
- }
-
- return 0;
+ o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
+ else
+ samplerate = 0;
+
+ ctx->header = g_string_sized_new(512);
+ g_string_append_printf(ctx->header, ";Rate: %"PRIu64"\n", samplerate);
+ g_string_append_printf(ctx->header, ";Channels: %d\n", num_enabled_probes);
+ 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");
+
+ return SR_OK;