devc->submitted_transfers++;
}
- if (devc->profile->dev_caps & DEV_CAPS_AX_ANALOG)
+ /*
+ * If this device has analog channels and at least one of them is
+ * enabled, use mso_send_data_proc() to properly handle the analog
+ * data. Otherwise use la_send_data_proc().
+ */
+ if (g_slist_length(devc->enabled_analog_channels) > 0)
devc->send_data_proc = mso_send_data_proc;
else
devc->send_data_proc = la_send_data_proc;
for (l = sdi->channels, p = 0; l; l = l->next, p++) {
ch = l->data;
- if ((p <= NUM_CHANNELS) && (ch->type == SR_CHANNEL_ANALOG)) {
+ if ((p <= NUM_CHANNELS) && (ch->type == SR_CHANNEL_ANALOG)
+ && (ch->enabled)) {
num_analog++;
devc->enabled_analog_channels =
g_slist_append(devc->enabled_analog_channels, ch);
}
}
- /* Use no wide sampling if we have only the first 8 channels set. */
+ /*
+ * Use wide sampling if either any of the LA channels 8..15 is enabled
+ * and/or at least one analog channel is enabled.
+ */
devc->sample_wide = (channel_mask > 0xff || num_analog > 0);
return SR_OK;
} else {
size = fx2lafw_get_buffer_size(devc);
/* Prepare for analog sampling. */
- if (devc->profile->dev_caps & DEV_CAPS_AX_ANALOG) {
+ if (g_slist_length(devc->enabled_analog_channels) > 0) {
/* We need a buffer half the size of a transfer. */
devc->logic_buffer = g_try_malloc(size / 2);
devc->analog_buffer = g_try_malloc(
cmd.flags |= devc->sample_wide ? CMD_START_FLAGS_SAMPLE_16BIT :
CMD_START_FLAGS_SAMPLE_8BIT;
/* Enable CTL2 clock. */
- cmd.flags |= (devc->profile->dev_caps & DEV_CAPS_AX_ANALOG) ? CMD_START_FLAGS_CLK_CTL2 : 0;
+ cmd.flags |= (g_slist_length(devc->enabled_analog_channels) > 0) ? CMD_START_FLAGS_CLK_CTL2 : 0;
/* Send the control message. */
ret = libusb_control_transfer(usb->devhdl, LIBUSB_REQUEST_TYPE_VENDOR |
devc->num_transfers = 0;
g_free(devc->transfers);
- /* Free the deinterlace buffers if we had them */
- g_free(devc->logic_buffer);
- g_free(devc->analog_buffer);
+ /* Free the deinterlace buffers if we had them. */
+ if (g_slist_length(devc->enabled_analog_channels) > 0) {
+ g_free(devc->logic_buffer);
+ g_free(devc->analog_buffer);
+ }
if (devc->stl) {
soft_trigger_logic_free(devc->stl);