X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fchronovu-la%2Fapi.c;h=526d51cf3bba27f05dcd820e7c213f5fa5d9335c;hb=a4e435eb49c1fa30c31d5851b404001324cafe33;hp=228d632aac23879d7ae0a6146a2265a12cf2b640;hpb=b0efc84e12c97afc59ae53225a4e59c2fa9459ef;p=libsigrok.git diff --git a/hardware/chronovu-la/api.c b/hardware/chronovu-la/api.c index 228d632a..526d51cf 100644 --- a/hardware/chronovu-la/api.c +++ b/hardware/chronovu-la/api.c @@ -26,10 +26,18 @@ static struct sr_dev_driver *di = &chronovu_la_driver_info; static const int32_t hwcaps[] = { SR_CONF_LOGIC_ANALYZER, SR_CONF_SAMPLERATE, + SR_CONF_TRIGGER_MATCH, SR_CONF_LIMIT_MSEC, /* TODO: Not yet implemented. */ SR_CONF_LIMIT_SAMPLES, /* TODO: Not yet implemented. */ }; +static const int32_t trigger_matches[] = { + SR_TRIGGER_ZERO, + SR_TRIGGER_ONE, + SR_TRIGGER_RISING, + SR_TRIGGER_FALLING, +}; + /* The ChronoVu LA8/LA16 can have multiple VID/PID pairs. */ static struct { uint16_t vid; @@ -167,8 +175,12 @@ static GSList *scan(GSList *options) for (i = 0; i < ARRAY_SIZE(vid_pid); i++) { ret = ftdi_usb_open_desc(ftdic, vid_pid[i].vid, vid_pid[i].pid, vid_pid[i].iproduct, NULL); + /* Show errors other than "device not found". */ + if (ret < 0 && ret != -3) + sr_dbg("Error finding/opening device (%d): %s.", + ret, ftdi_get_error_string(ftdic)); if (ret < 0) - continue; /* No device found. */ + continue; /* No device found, or not usable. */ sr_dbg("Found %s device (%04x:%04x).", vid_pid[i].iproduct, vid_pid[i].vid, vid_pid[i].pid); @@ -355,14 +367,21 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, *data = g_variant_builder_end(&gvb); break; case SR_CONF_LIMIT_SAMPLES: + if (!sdi || !sdi->priv || !(devc = sdi->priv) || !devc->prof) + return SR_ERR_BUG; grange[0] = g_variant_new_uint64(0); - grange[1] = g_variant_new_uint64(MAX_NUM_SAMPLES); + if (devc->prof->model == CHRONOVU_LA8) + grange[1] = g_variant_new_uint64(MAX_NUM_SAMPLES); + else + grange[1] = g_variant_new_uint64(MAX_NUM_SAMPLES / 2); *data = g_variant_new_tuple(grange, 2); break; - case SR_CONF_TRIGGER_TYPE: + case SR_CONF_TRIGGER_MATCH: if (!sdi || !sdi->priv || !(devc = sdi->priv) || !devc->prof) return SR_ERR_BUG; - *data = g_variant_new_string(devc->prof->trigger_type); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, + trigger_matches, devc->prof->num_trigger_matches, + sizeof(int32_t)); break; default: return SR_ERR_NA; @@ -451,8 +470,8 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) return SR_ERR; } - if (cv_configure_channels(sdi) != SR_OK) { - sr_err("Failed to configure channels."); + if (cv_convert_trigger(sdi) != SR_OK) { + sr_err("Failed to configure trigger."); return SR_ERR; }