/* Properly close all devices. */
for (l = drvc->instances; l; l = l->next) {
if (!(sdi = l->data)) {
/* Log error, but continue cleaning up the rest. */
/* Properly close all devices. */
for (l = drvc->instances; l; l = l->next) {
if (!(sdi = l->data)) {
/* Log error, but continue cleaning up the rest. */
devices = NULL;
/* Allocate memory for our private device context. */
if (!(devc = g_try_malloc(sizeof(struct dev_context)))) {
devices = NULL;
/* Allocate memory for our private device context. */
if (!(devc = g_try_malloc(sizeof(struct dev_context)))) {
/* Allocate memory where we'll store the de-mangled data. */
if (!(devc->final_buf = g_try_malloc(SDRAM_SIZE))) {
/* Allocate memory where we'll store the de-mangled data. */
if (!(devc->final_buf = g_try_malloc(SDRAM_SIZE))) {
goto err_free_devc;
}
/* Allocate memory for the FTDI context (ftdic) and initialize it. */
if (!(devc->ftdic = ftdi_new())) {
goto err_free_devc;
}
/* Allocate memory for the FTDI context (ftdic) and initialize it. */
if (!(devc->ftdic = ftdi_new())) {
usb_pids[i]);
ret = ftdi_usb_open_desc(devc->ftdic, USB_VENDOR_ID,
usb_pids[i], USB_DESCRIPTION, NULL);
if (ret == 0) {
usb_pids[i]);
ret = ftdi_usb_open_desc(devc->ftdic, USB_VENDOR_ID,
usb_pids[i], USB_DESCRIPTION, NULL);
if (ret == 0) {
USB_VENDOR_ID, usb_pids[i]);
devc->usb_pid = usb_pids[i];
}
USB_VENDOR_ID, usb_pids[i]);
devc->usb_pid = usb_pids[i];
}
sdi = sr_dev_inst_new(0, SR_ST_INITIALIZING,
USB_VENDOR_NAME, USB_MODEL_NAME, USB_MODEL_VERSION);
if (!sdi) {
sdi = sr_dev_inst_new(0, SR_ST_INITIALIZING,
USB_VENDOR_NAME, USB_MODEL_NAME, USB_MODEL_VERSION);
if (!sdi) {
- if (!(probe = sr_probe_new(i, SR_PROBE_ANALOG, TRUE,
- probe_names[i])))
+ if (!(probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE,
+ probe_names[i])))
devices = g_slist_append(devices, sdi);
drvc->instances = g_slist_append(drvc->instances, sdi);
devices = g_slist_append(devices, sdi);
drvc->instances = g_slist_append(drvc->instances, sdi);
/* Close device. We'll reopen it again when we need it. */
(void) la8_close(devc); /* Log, but ignore errors. */
/* Close device. We'll reopen it again when we need it. */
(void) la8_close(devc); /* Log, but ignore errors. */
static int hw_dev_open(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
int ret;
if (!(devc = sdi->priv)) {
static int hw_dev_open(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
int ret;
if (!(devc = sdi->priv)) {
devc->usb_pid);
/* Open the device. */
if ((ret = ftdi_usb_open_desc(devc->ftdic, USB_VENDOR_ID,
devc->usb_pid, USB_DESCRIPTION, NULL)) < 0) {
devc->usb_pid);
/* Open the device. */
if ((ret = ftdi_usb_open_desc(devc->ftdic, USB_VENDOR_ID,
devc->usb_pid, USB_DESCRIPTION, NULL)) < 0) {
__func__, ret, ftdi_get_error_string(devc->ftdic));
(void) la8_close_usb_reset_sequencer(devc); /* Ignore errors. */
return SR_ERR;
}
__func__, ret, ftdi_get_error_string(devc->ftdic));
(void) la8_close_usb_reset_sequencer(devc); /* Ignore errors. */
return SR_ERR;
}
__func__, ret, ftdi_get_error_string(devc->ftdic));
(void) la8_close_usb_reset_sequencer(devc); /* Ignore errors. */
goto err_dev_open_close_ftdic;
}
__func__, ret, ftdi_get_error_string(devc->ftdic));
(void) la8_close_usb_reset_sequencer(devc); /* Ignore errors. */
goto err_dev_open_close_ftdic;
}
/* Enable flow control in the FTDI chip. */
if ((ret = ftdi_setflowctrl(devc->ftdic, SIO_RTS_CTS_HS)) < 0) {
/* Enable flow control in the FTDI chip. */
if ((ret = ftdi_setflowctrl(devc->ftdic, SIO_RTS_CTS_HS)) < 0) {
__func__, ret, ftdi_get_error_string(devc->ftdic));
(void) la8_close_usb_reset_sequencer(devc); /* Ignore errors. */
goto err_dev_open_close_ftdic;
}
__func__, ret, ftdi_get_error_string(devc->ftdic));
(void) la8_close_usb_reset_sequencer(devc); /* Ignore errors. */
goto err_dev_open_close_ftdic;
}
return SR_ERR_BUG;
}
switch (hwcap) {
case SR_HWCAP_SAMPLERATE:
if (set_samplerate(sdi, *(const uint64_t *)value) == SR_ERR) {
return SR_ERR_BUG;
}
switch (hwcap) {
case SR_HWCAP_SAMPLERATE:
if (set_samplerate(sdi, *(const uint64_t *)value) == SR_ERR) {
/* All data was received and demangled, send it to the session bus. */
for (i = 0; i < NUM_BLOCKS; i++)
/* All data was received and demangled, send it to the session bus. */
for (i = 0; i < NUM_BLOCKS; i++)