X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Ffx2lafw%2Fapi.c;h=4e4c3cfabce53befad346ec69a8e22773056b9c7;hb=8399f68a3ff44e72b2267d43aaba677b0dbd48b4;hp=0f9cadb64cc5337789482facc4e35a406b5a4f6b;hpb=7087a8b0fa24ac9e579ce68452f025a73d115dcb;p=libsigrok.git diff --git a/src/hardware/fx2lafw/api.c b/src/hardware/fx2lafw/api.c index 0f9cadb6..4e4c3cfa 100644 --- a/src/hardware/fx2lafw/api.c +++ b/src/hardware/fx2lafw/api.c @@ -335,7 +335,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) des.idProduct == supported_fx2[j].pid && (!supported_fx2[j].usb_manufacturer || !strcmp(manufacturer, supported_fx2[j].usb_manufacturer)) && - (!supported_fx2[j].usb_manufacturer || + (!supported_fx2[j].usb_product || !strcmp(product, supported_fx2[j].usb_product))) { prof = &supported_fx2[j]; break; @@ -383,8 +383,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) devc = fx2lafw_dev_new(); devc->profile = prof; - if ((prof->dev_caps & DEV_CAPS_16BIT) || (prof->dev_caps & DEV_CAPS_AX_ANALOG)) - devc->sample_wide = TRUE; sdi->priv = devc; devices = g_slist_append(devices, sdi); @@ -981,6 +979,7 @@ static int configure_channels(const struct sr_dev_inst *sdi) const GSList *l; int p; struct sr_channel *ch; + uint32_t channel_mask = 0, num_analog = 0; devc = sdi->priv; @@ -991,12 +990,18 @@ static int configure_channels(const struct sr_dev_inst *sdi) for (l = sdi->channels, p = 0; l; l = l->next, p++) { ch = l->data; if ((p <= NUM_CHANNELS) && (ch->type == SR_CHANNEL_ANALOG)) { + num_analog++; devc->ch_enabled[p] = ch->enabled; devc->enabled_analog_channels = g_slist_append(devc->enabled_analog_channels, ch); + } else { + channel_mask |= ch->enabled << p; } } + /* Use no wide sampling if we have only the first 8 channels set. */ + devc->sample_wide = (channel_mask > 0xff || num_analog > 0); + return SR_OK; }