X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=session.c;h=68b1913e323f3f3997ed8b3b67c8c4c26cabd55f;hb=01d9dc35ad8ba6817170ac9cca6c7e4fce989b78;hp=13b7a241a9cbf43555d72a5acf35e9c86577b7ef;hpb=544a458212dc972b663e67cd522ba54cbd8a00de;p=libsigrok.git diff --git a/session.c b/session.c index 13b7a241..68b1913e 100644 --- a/session.c +++ b/session.c @@ -83,19 +83,19 @@ void session_device_clear(void) session->devices = NULL; } -int session_device_add(struct device *device) +int session_device_add(struct sr_device *device) { int ret; if (device->plugin && device->plugin->open) { ret = device->plugin->open(device->plugin_index); - if (ret != SIGROK_OK) + if (ret != SR_OK) return ret; } session->devices = g_slist_append(session->devices, device); - return SIGROK_OK; + return SR_OK; } void session_pa_clear(void) @@ -127,7 +127,7 @@ void session_datafeed_callback_add(datafeed_callback callback) int session_start(void) { - struct device *device; + struct sr_device *device; GSList *l; int ret; @@ -135,7 +135,7 @@ int session_start(void) for (l = session->devices; l; l = l->next) { device = l->data; if ((ret = device->plugin->start_acquisition( - device->plugin_index, device)) != SIGROK_OK) + device->plugin_index, device)) != SR_OK) break; } @@ -196,7 +196,7 @@ void session_halt(void) void session_stop(void) { - struct device *device; + struct sr_device *device; GSList *l; g_message("stopping session"); @@ -209,7 +209,7 @@ void session_stop(void) } -void session_bus(struct device *device, struct datafeed_packet *packet) +void session_bus(struct sr_device *device, struct sr_datafeed_packet *packet) { GSList *l; datafeed_callback cb; @@ -228,7 +228,7 @@ int session_save(char *filename) { GSList *l, *p, *d; FILE *meta; - struct device *device; + struct sr_device *device; struct probe *probe; struct datastore *ds; struct zip *zipfile; @@ -244,23 +244,23 @@ int session_save(char *filename) /* Quietly delete it first, libzip wants replace ops otherwise. */ unlink(newfn); if (!(zipfile = zip_open(newfn, ZIP_CREATE, &error))) - return SIGROK_ERR; + return SR_ERR; g_free(newfn); /* "version" */ version[0] = '1'; if (!(versrc = zip_source_buffer(zipfile, version, 1, 0))) - return SIGROK_ERR; + return SR_ERR; if (zip_add(zipfile, "version", versrc) == -1) { g_message("error saving version into zipfile: %s", zip_strerror(zipfile)); - return SIGROK_ERR; + return SR_ERR; } /* init "metadata" */ strcpy(metafile, "sigrok-meta-XXXXXX"); if ((tmpfile = g_mkstemp(metafile)) == -1) - return SIGROK_ERR; + return SR_ERR; close(tmpfile); meta = fopen(metafile, "wb"); fprintf(meta, "sigrok version = %s\n", PACKAGE_VERSION); @@ -303,28 +303,28 @@ int session_save(char *filename) } if (!(logicsrc = zip_source_buffer(zipfile, buf, ds->num_units * ds->ds_unitsize, TRUE))) - return SIGROK_ERR; + return SR_ERR; snprintf(rawname, 15, "logic-%d", devcnt); if (zip_add(zipfile, rawname, logicsrc) == -1) - return SIGROK_ERR; + return SR_ERR; } devcnt++; } fclose(meta); if (!(metasrc = zip_source_file(zipfile, metafile, 0, -1))) - return SIGROK_ERR; + return SR_ERR; if (zip_add(zipfile, "metadata", metasrc) == -1) - return SIGROK_ERR; + return SR_ERR; if ((ret = zip_close(zipfile)) == -1) { g_message("error saving zipfile: %s", zip_strerror(zipfile)); - return SIGROK_ERR; + return SR_ERR; } unlink(metafile); - return SIGROK_OK; + return SR_OK; } void session_source_add(int fd, int events, int timeout,