SR_CONF_LIMIT_SAMPLES | SR_CONF_SET,
SR_CONF_SAMPLERATE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
SR_CONF_CONN | SR_CONF_GET,
SR_CONF_LIMIT_SAMPLES | SR_CONF_SET,
SR_CONF_SAMPLERATE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
SR_CONF_CONN | SR_CONF_GET,
-static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
-{
- return std_init(sr_ctx, di, LOG_PREFIX);
-}
-
-static void scan_device(struct sr_dev_driver *di, struct libusb_device *dev, GSList **devices)
+static void scan_device(struct ftdi_context *ftdic,
+ struct libusb_device *dev, GSList **devices)
{
struct libusb_device_descriptor usb_desc;
const struct ftdi_chip_desc *desc;
struct dev_context *devc;
char *vendor, *model, *serial_num;
struct sr_dev_inst *sdi;
{
struct libusb_device_descriptor usb_desc;
const struct ftdi_chip_desc *desc;
struct dev_context *devc;
char *vendor, *model, *serial_num;
struct sr_dev_inst *sdi;
- rv = ftdi_usb_get_strings(devc->ftdic, dev, vendor, 32,
- model, 32, serial_num, 32);
+ rv = ftdi_usb_get_strings(ftdic, dev, vendor, 32,
+ model, 32, serial_num, 32);
for (char *const *chan = &(desc->channel_names[0]); *chan; chan++)
sr_channel_new(sdi, chan - &(desc->channel_names[0]),
SR_CHANNEL_LOGIC, TRUE, *chan);
*devices = g_slist_append(*devices, sdi);
for (char *const *chan = &(desc->channel_names[0]); *chan; chan++)
sr_channel_new(sdi, chan - &(desc->channel_names[0]),
SR_CHANNEL_LOGIC, TRUE, *chan);
*devices = g_slist_append(*devices, sdi);
ret = ftdi_usb_find_all(ftdic, &devlist, 0, 0);
if (ret < 0) {
sr_err("Failed to list devices (%d): %s", ret,
ftdi_get_error_string(ftdic));
ret = ftdi_usb_find_all(ftdic, &devlist, 0, 0);
if (ret < 0) {
sr_err("Failed to list devices (%d): %s", ret,
ftdi_get_error_string(ftdic));
usb = l->data;
if (usb->bus == libusb_get_bus_number(devlist[i])
&& usb->address == libusb_get_device_address(devlist[i])) {
usb = l->data;
if (usb->bus == libusb_get_bus_number(devlist[i])
&& usb->address == libusb_get_device_address(devlist[i])) {
if (ret < 0) {
/* Log errors, except for -3 ("device not found"). */
if (ret != -3)
sr_err("Failed to open device (%d): %s", ret,
ftdi_get_error_string(devc->ftdic));
if (ret < 0) {
/* Log errors, except for -3 ("device not found"). */
if (ret != -3)
sr_err("Failed to open device (%d): %s", ret,
ftdi_get_error_string(devc->ftdic));
static int config_get(uint32_t key, GVariant **data,
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
{
static int config_get(uint32_t key, GVariant **data,
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
{
/* Hook up a dummy handler to receive data from the device. */
sr_session_source_add(sdi->session, -1, G_IO_IN, 0,
/* Hook up a dummy handler to receive data from the device. */
sr_session_source_add(sdi->session, -1, G_IO_IN, 0,
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
sr_dbg("Stopping acquisition.");
sr_session_source_remove(sdi->session, -1);
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
sr_dbg("Stopping acquisition.");
sr_session_source_remove(sdi->session, -1);
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,