- ds = device->datastore;
- if (ds) {
- /* metadata */
- fprintf(meta, "capturefile = logic-%d\n", devcnt);
- fprintf(meta, "unitsize = %d\n", ds->ds_unitsize);
- fprintf(meta, "total probes = %d\n", g_slist_length(device->probes));
- if (sr_device_has_hwcap(device, SR_HWCAP_SAMPLERATE)) {
- samplerate = *((uint64_t *) device->plugin->get_device_info(
- device->plugin_index, SR_DI_CUR_SAMPLERATE));
- s = sr_samplerate_string(samplerate);
- fprintf(meta, "samplerate = %s\n", s);
- free(s);
- }
- probecnt = 1;
- for (p = device->probes; p; p = p->next) {
- probe = p->data;
- if (probe->enabled) {
- if (probe->name)
- fprintf(meta, "probe%d = %s\n", probecnt, probe->name);
- if (probe->trigger)
- fprintf(meta, " trigger%d = %s\n", probecnt, probe->trigger);
- probecnt++;
- }
- }
-
- /* dump datastore into logic-n */
- buf = malloc(ds->num_units * ds->ds_unitsize +
- DATASTORE_CHUNKSIZE);
- bufcnt = 0;
- for (d = ds->chunklist; d; d = d->next) {
- memcpy(buf + bufcnt, d->data,
- DATASTORE_CHUNKSIZE);
- bufcnt += DATASTORE_CHUNKSIZE;
- }
- if (!(logicsrc = zip_source_buffer(zipfile, buf,
- ds->num_units * ds->ds_unitsize, TRUE)))
- return SR_ERR;
- snprintf(rawname, 15, "logic-%d", devcnt);
- if (zip_add(zipfile, rawname, logicsrc) == -1)
- return SR_ERR;
+ /* metadata */
+ fprintf(meta, "capturefile = logic-1\n");
+ fprintf(meta, "unitsize = %d\n", ds->ds_unitsize);
+ fprintf(meta, "total probes = %d\n", g_slist_length(sdi->probes));
+ if (sr_dev_has_hwcap(sdi, SR_HWCAP_SAMPLERATE)) {
+ if (sr_info_get(sdi->driver, SR_DI_CUR_SAMPLERATE,
+ (const void **)&samplerate, sdi) == SR_OK) {
+ s = sr_samplerate_string(*samplerate);
+ fprintf(meta, "samplerate = %s\n", s);
+ g_free(s);