/*
* 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
{ 0, 0, 0, 0, 0, 0, 0 }
};
-static int hwcaps[] = {
+static const int hwcaps[] = {
SR_HWCAP_LOGIC_ANALYZER,
SR_HWCAP_SAMPLERATE,
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++) {
return sdi->status;
}
-static int *hw_hwcap_get_all(void)
+static const int *hw_hwcap_get_all(void)
{
return hwcaps;
}
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);