- ctx->header = calloc(1, MAX_HEADER_LEN + 1);
- if (ctx->header == NULL)
- return SIGROK_ERR_MALLOC;
- num_probes = g_slist_length(o->device->probes);
- /* TODO: Handle num_probes == 0, too many probes, etc. */
- samplerate = *((uint64_t *) o->device->plugin->get_device_info(
- o->device->plugin_index, DI_CUR_SAMPLERATE));
-
- /* Samplerate string */
- if (samplerate >= GHZ(1))
- snprintf(sbuf, 10, "%"PRIu64" GHz", samplerate / 1000000000);
- else if (samplerate >= MHZ(1))
- snprintf(sbuf, 10, "%"PRIu64" MHz", samplerate / 1000000);
- else if (samplerate >= KHZ(1))
- snprintf(sbuf, 10, "%"PRIu64" KHz", samplerate / 1000);
+ /* timescale */
+ /* VCD can only handle 1/10/100 (s - fs), so scale up first */
+ if (ctx->samplerate > SR_MHZ(1))
+ ctx->period = SR_GHZ(1);
+ else if (ctx->samplerate > SR_KHZ(1))
+ ctx->period = SR_MHZ(1);