]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/fx2lafw/api.c
scpi-dmm: Add support for Owon XDM2041
[libsigrok.git] / src / hardware / fx2lafw / api.c
index abb867884ed0ba9ae8e10acf242487f829f45c41..5acb0016d0b8e6ab5ad204aea7e238f55e2f5fa8 100644 (file)
@@ -105,6 +105,13 @@ static const struct fx2lafw_profile supported_fx2[] = {
                "fx2lafw-sigrok-fx2-16ch.fw",
                DEV_CAPS_16BIT, NULL, NULL },
 
+       /*
+        * usb-c-grok
+        */
+       { 0x1d50, 0x608f, "sigrok", "usb-c-grok", NULL,
+               "fx2lafw-usb-c-grok.fw",
+               0, NULL, NULL},
+
        ALL_ZERO
 };
 
@@ -118,6 +125,7 @@ static const uint32_t drvopts[] = {
 
 static const uint32_t devopts[] = {
        SR_CONF_CONTINUOUS,
+       SR_CONF_LIMIT_FRAMES | SR_CONF_GET | SR_CONF_SET,
        SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
        SR_CONF_CONN | SR_CONF_GET,
        SR_CONF_SAMPLERATE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
@@ -150,6 +158,7 @@ static const uint64_t samplerates[] = {
        SR_MHZ(12),
        SR_MHZ(16),
        SR_MHZ(24),
+       SR_MHZ(48),
 };
 
 static gboolean is_plausible(const struct libusb_device_descriptor *des)
@@ -265,7 +274,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
 
                libusb_close(hdl);
 
-               usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
+               if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0)
+                       continue;
 
                prof = NULL;
                for (j = 0; supported_fx2[j].vid; j++) {
@@ -337,14 +347,16 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
                                        libusb_get_device_address(devlist[i]), NULL);
                } else {
                        if (ezusb_upload_firmware(drvc->sr_ctx, devlist[i],
-                                       USB_CONFIGURATION, prof->firmware) == SR_OK)
+                                       USB_CONFIGURATION, prof->firmware) == SR_OK) {
                                /* Store when this device's FW was updated. */
                                devc->fw_updated = g_get_monotonic_time();
-                       else
+                       } else {
                                sr_err("Firmware upload failed for "
-                                      "device %d.%d (logical).",
+                                      "device %d.%d (logical), name %s.",
                                       libusb_get_bus_number(devlist[i]),
-                                      libusb_get_device_address(devlist[i]));
+                                      libusb_get_device_address(devlist[i]),
+                                      prof->firmware);
+                       }
                        sdi->inst_type = SR_INST_USB;
                        sdi->conn = sr_usb_dev_inst_new(libusb_get_bus_number(devlist[i]),
                                        0xff, NULL);
@@ -480,6 +492,9 @@ static int config_get(uint32_t key, GVariant **data,
                        return SR_ERR;
                *data = g_variant_new_printf("%d.%d", usb->bus, usb->address);
                break;
+       case SR_CONF_LIMIT_FRAMES:
+               *data = g_variant_new_uint64(devc->limit_frames);
+               break;
        case SR_CONF_LIMIT_SAMPLES:
                *data = g_variant_new_uint64(devc->limit_samples);
                break;
@@ -515,6 +530,9 @@ static int config_set(uint32_t key, GVariant *data,
                        return SR_ERR_ARG;
                devc->cur_samplerate = devc->samplerates[idx];
                break;
+       case SR_CONF_LIMIT_FRAMES:
+               devc->limit_frames = g_variant_get_uint64(data);
+               break;
        case SR_CONF_LIMIT_SAMPLES:
                devc->limit_samples = g_variant_get_uint64(data);
                break;
@@ -538,6 +556,8 @@ static int config_list(uint32_t key, GVariant **data,
        switch (key) {
        case SR_CONF_SCAN_OPTIONS:
        case SR_CONF_DEVICE_OPTIONS:
+               if (cg)
+                       return SR_ERR_NA;
                return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
        case SR_CONF_SAMPLERATE:
                if (!devc)