]> sigrok.org Git - libsigrok.git/blobdiff - hardware/chronovu-la/api.c
chronovu-la: Show errors other than "device not found".
[libsigrok.git] / hardware / chronovu-la / api.c
index d783f4fee9480ffb60c6f212e83949575a7cea2c..b232a10b966a3b31964a43308167a130a5006edb 100644 (file)
@@ -26,6 +26,7 @@ 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_TYPE,
        SR_CONF_LIMIT_MSEC, /* TODO: Not yet implemented. */
        SR_CONF_LIMIT_SAMPLES, /* TODO: Not yet implemented. */
 };
@@ -167,8 +168,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,8 +360,13 @@ 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:
@@ -410,7 +420,14 @@ static int receive_data(int fd, int revents, void *cb_data)
 
        sr_dbg("Sampling finished, sending data to session bus now.");
 
-       /* All data was received and demangled, send it to the session bus. */
+       /*
+        * All data was received and demangled, send it to the session bus.
+        *
+        * Note: Due to the method how data is spread across the 8MByte of
+        * SDRAM, we can _not_ send it to the session bus in a streaming
+        * manner while we receive it. We have to receive and de-mangle the
+        * full 8MByte first, only then the whole buffer contains valid data.
+        */
        for (i = 0; i < NUM_BLOCKS; i++)
                cv_send_block_to_session_bus(devc, i);