#include <config.h>
#include "protocol.h"
-static const uint32_t devopts[] = {
+static const uint32_t drvopts[] = {
SR_CONF_LOGIC_ANALYZER,
+};
+
+static const uint32_t devopts[] = {
SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
SR_CONF_SAMPLERATE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
SR_CONF_TRIGGER_MATCH | SR_CONF_LIST,
devices = NULL;
- /* Allocate memory for our private device context. */
devc = g_malloc0(sizeof(struct dev_context));
- /* Device-specific settings */
devc->max_samplebytes = devc->max_samplerate = devc->protocol_version = 0;
- /* Acquisition settings */
devc->limit_samples = devc->capture_ratio = 0;
devc->trigger_at = -1;
devc->channel_mask = 0xffffffff;
devc->flag_reg = 0;
- /* Allocate memory for the incoming ftdi data. */
devc->ftdi_buf = g_malloc0(FTDI_BUF_SIZE);
- /* Allocate memory for the FTDI context (ftdic) and initialize it. */
if (!(devc->ftdic = ftdi_new())) {
sr_err("Failed to initialize libftdi.");
goto err_free_ftdi_buf;;
}
- /* Try to open the FTDI device */
- if (p_ols_open(devc) != SR_OK) {
+ if (p_ols_open(devc) != SR_OK)
goto err_free_ftdic;
- }
/* The discovery procedure is like this: first send the Reset
* command (0x00) 5 times, since the device could be anywhere
goto err_close_ftdic;
}
- /* Close device. We'll reopen it again when we need it. */
p_ols_close(devc);
/* Parse the metadata. */
err_close_ftdic:
p_ols_close(devc);
err_free_ftdic:
- ftdi_free(devc->ftdic); /* NOT free() or g_free()! */
+ ftdi_free(devc->ftdic);
err_free_ftdi_buf:
g_free(devc->ftdi_buf);
g_free(devc);
switch (key) {
case SR_CONF_DEVICE_OPTIONS:
- return STD_CONFIG_LIST(key, data, sdi, cg, NULL, NULL, devopts);
+ return STD_CONFIG_LIST(key, data, sdi, cg, NULL, drvopts, devopts);
case SR_CONF_SAMPLERATE:
g_variant_builder_init(&gvb, G_VARIANT_TYPE("a{sv}"));
gvar = g_variant_new_fixed_array(G_VARIANT_TYPE("t"), samplerates,