SR_CONF_CONN,
};
-static const uint32_t devopts[] = {
+static const uint32_t drvopts[] = {
SR_CONF_LOGIC_ANALYZER,
+};
+
+static const uint32_t devopts[] = {
SR_CONF_CONTINUOUS,
SR_CONF_LIMIT_SAMPLES | SR_CONF_SET,
SR_CONF_SAMPLERATE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
.product = 0x6010,
.samplerate_div = 20,
.channel_names = {
- "ADBUS0",
- "ADBUS1",
- "ADBUS2",
- "ADBUS3",
- "ADBUS4",
- "ADBUS5",
- "ADBUS6",
- "ADBUS7",
+ "ADBUS0", "ADBUS1", "ADBUS2", "ADBUS3",
+ "ADBUS4", "ADBUS5", "ADBUS6", "ADBUS7",
/* TODO: BDBUS[0..7] channels. */
NULL
}
.product = 0x6001,
.samplerate_div = 30,
.channel_names = {
- "TXD",
- "RXD",
- "RTS#",
- "CTS#",
- "DTR#",
- "DSR#",
- "DCD#",
- "RI#",
+ "TXD", "RXD", "RTS#", "CTS#", "DTR#", "DSR#", "DCD#", "RI#",
NULL
}
};
return;
}
- /* Allocate memory for our private device context. */
devc = g_malloc0(sizeof(struct dev_context));
/* Allocate memory for the incoming data. */
}
sr_dbg("Found an FTDI device: %s.", model);
- /* Register the device with libsigrok. */
sdi = g_malloc0(sizeof(struct sr_dev_inst));
sdi->status = SR_ST_INACTIVE;
sdi->vendor = vendor;
}
}
- /* Allocate memory for the FTDI context (ftdic) and initialize it. */
ftdic = ftdi_new();
if (!ftdic) {
sr_err("Failed to initialize libftdi.");
goto err_ftdi_free;
}
- /* Purge RX/TX buffers in the FTDI chip. */
ret = ftdi_usb_purge_buffers(devc->ftdic);
if (ret < 0) {
sr_err("Failed to purge FTDI RX/TX buffers (%d): %s.",
goto err_dev_open_close_ftdic;
}
- /* Reset the FTDI bitmode. */
ret = ftdi_set_bitmode(devc->ftdic, 0x00, BITMODE_RESET);
if (ret < 0) {
sr_err("Failed to reset the FTDI chip bitmode (%d): %s.",
{
struct dev_context *devc;
struct sr_usb_dev_inst *usb;
- char str[128];
(void)cg;
if (!sdi || !sdi->conn)
return SR_ERR_ARG;
usb = sdi->conn;
- snprintf(str, 128, "%d.%d", usb->bus, usb->address);
- *data = g_variant_new_string(str);
+ *data = g_variant_new_printf("%d.%d", usb->bus, usb->address);
break;
default:
return SR_ERR_NA;
/* TODO: Implement. */
return SR_ERR_NA;
case SR_CONF_LIMIT_SAMPLES:
- if (g_variant_get_uint64(data) == 0)
- return SR_ERR_ARG;
devc->limit_samples = g_variant_get_uint64(data);
break;
case SR_CONF_SAMPLERATE:
static int config_list(uint32_t key, GVariant **data,
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
{
- GVariant *gvar;
- GVariantBuilder gvb;
-
switch (key) {
case SR_CONF_SCAN_OPTIONS:
case SR_CONF_DEVICE_OPTIONS:
- return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, NULL, devopts);
+ return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, 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, ARRAY_SIZE(samplerates), sizeof(uint64_t));
- g_variant_builder_add(&gvb, "{sv}", "samplerate-steps", gvar);
- *data = g_variant_builder_end(&gvb);
+ *data = std_gvar_samplerates_steps(ARRAY_AND_SIZE(samplerates));
break;
default:
return SR_ERR_NA;