/*
* This file is part of the sigrok project.
*
+ * Copyright (C) 2010-2012 Bert Vermeulen <bert@biot.com>
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
*
* This program is free software: you can redistribute it and/or modify
break;
}
- if (vi.major != FX2LAFW_VERSION_MAJOR ||
- vi.minor != FX2LAFW_VERSION_MINOR) {
- sr_err("fx2lafw: Expected firmware version %d.%d "
- "got %d.%d.", FX2LAFW_VERSION_MAJOR,
- FX2LAFW_VERSION_MINOR, vi.major, vi.minor);
+ /*
+ * Changes in major version mean incompatible/API changes, so
+ * bail out if we encounter an incompatible version.
+ * Different minor versions are OK, they should be compatible.
+ */
+ if (vi.major != FX2LAFW_REQUIRED_VERSION_MAJOR) {
+ sr_err("fx2lafw: Expected firmware version %d.x, "
+ "got %d.%d.", FX2LAFW_REQUIRED_VERSION_MAJOR,
+ vi.major, vi.minor);
break;
}
return 0;
}
- /* Find all fx2lafw compatible devices and upload firware to them. */
+ /* Find all fx2lafw compatible devices and upload firmware to them. */
libusb_get_device_list(usb_context, &devlist);
for (i = 0; devlist[i]; i++) {
ctx = sdi->priv;
/*
- * If the firmware was recently uploaded, wait up to MAX_RENUM_DELAY ms
- * for the FX2 to renumerate.
+ * If the firmware was recently uploaded, wait up to MAX_RENUM_DELAY_MS
+ * milliseconds for the FX2 to renumerate.
*/
ret = 0;
/* takes at least 300ms for the FX2 to be gone from the USB bus */
g_usleep(300 * 1000);
timediff_ms = 0;
- while (timediff_ms < MAX_RENUM_DELAY) {
+ while (timediff_ms < MAX_RENUM_DELAY_MS) {
if ((ret = fx2lafw_dev_open(dev_index)) == SR_OK)
break;
g_usleep(100 * 1000);
struct sr_dev_inst *sdi;
struct sr_datafeed_packet *packet;
struct sr_datafeed_header *header;
+ struct sr_datafeed_meta_logic meta;
struct context *ctx;
struct libusb_transfer *transfer;
const struct libusb_pollfd **lupfd;
packet->payload = header;
header->feed_version = 1;
gettimeofday(&header->starttime, NULL);
- header->samplerate = ctx->cur_samplerate;
- header->num_logic_probes = ctx->profile->num_probes;
sr_session_send(cb_data, packet);
+
+ /* Send metadata about the SR_DF_LOGIC packets to come. */
+ packet->type = SR_DF_META_LOGIC;
+ packet->payload = &meta;
+ meta.samplerate = ctx->cur_samplerate;
+ meta.num_probes = ctx->profile->num_probes;
+ sr_session_send(cb_data, packet);
+
g_free(header);
g_free(packet);