]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/fx2lafw/api.c
scpi-pps: Chroma 62000P: Get capabilities from device name
[libsigrok.git] / src / hardware / fx2lafw / api.c
index 5e1f66432298363178399e9031a940beb3ed4a83..ab3345f32cc81db6758261e48e1cd5423867b554 100644 (file)
@@ -106,9 +106,8 @@ static const uint32_t devopts[] = {
 };
 
 static const char *channel_names[] = {
-       "0",  "1",  "2",  "3",  "4",  "5",  "6",  "7",
-       "8",  "9", "10", "11", "12", "13", "14", "15",
-       NULL,
+       "0", "1", "2", "3", "4", "5", "6", "7",
+       "8", "9", "10", "11", "12", "13", "14", "15",
 };
 
 static const int32_t soft_trigger_matches[] = {
@@ -427,7 +426,7 @@ static int dev_close(struct sr_dev_inst *sdi)
        struct sr_usb_dev_inst *usb;
 
        usb = sdi->conn;
-       if (usb->devhdl == NULL)
+       if (!usb->devhdl)
                return SR_ERR;
 
        sr_info("fx2lafw: Closing device on %d.%d (logical) / %s (physical) interface %d.",
@@ -518,30 +517,30 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
        ret = SR_OK;
 
        switch (key) {
-               case SR_CONF_SAMPLERATE:
-                       arg = g_variant_get_uint64(data);
-                       for (i = 0; i < ARRAY_SIZE(samplerates); i++) {
-                               if (samplerates[i] == arg) {
-                                       devc->cur_samplerate = arg;
-                                       break;
-                               }
+       case SR_CONF_SAMPLERATE:
+               arg = g_variant_get_uint64(data);
+               for (i = 0; i < ARRAY_SIZE(samplerates); i++) {
+                       if (samplerates[i] == arg) {
+                               devc->cur_samplerate = arg;
+                               break;
                        }
-                       if (i == ARRAY_SIZE(samplerates))
-                               ret = SR_ERR_ARG;
-                       break;
-               case SR_CONF_LIMIT_SAMPLES:
-                       devc->limit_samples = g_variant_get_uint64(data);
-                       break;
-               case SR_CONF_CAPTURE_RATIO:
-                       devc->capture_ratio = g_variant_get_uint64(data);
-                       if (devc->capture_ratio > 100) {
-                               devc->capture_ratio = 0;
-                               ret = SR_ERR;
-                       } else
-                               ret = SR_OK;
-                       break;
-               default:
-                       ret = SR_ERR_NA;
+               }
+               if (i == ARRAY_SIZE(samplerates))
+                       ret = SR_ERR_ARG;
+               break;
+       case SR_CONF_LIMIT_SAMPLES:
+               devc->limit_samples = g_variant_get_uint64(data);
+               break;
+       case SR_CONF_CAPTURE_RATIO:
+               devc->capture_ratio = g_variant_get_uint64(data);
+               if (devc->capture_ratio > 100) {
+                       devc->capture_ratio = 0;
+                       ret = SR_ERR;
+               } else
+                       ret = SR_OK;
+               break;
+       default:
+               ret = SR_ERR_NA;
        }
 
        return ret;
@@ -630,7 +629,7 @@ static int start_transfers(const struct sr_dev_inst *sdi)
                if (devc->limit_samples > 0)
                        pre_trigger_samples = devc->capture_ratio * devc->limit_samples/100;
                devc->stl = soft_trigger_logic_new(sdi, trigger, pre_trigger_samples);
-               if (devc->stl == NULL)
+               if (!devc->stl)
                        return SR_ERR_MALLOC;
                devc->trigger_fired = FALSE;
        } else
@@ -678,7 +677,7 @@ static int start_transfers(const struct sr_dev_inst *sdi)
        return SR_OK;
 }
 
-static void dslogic_trigger_receive(struct libusb_transfer *transfer)
+static void LIBUSB_CALL dslogic_trigger_receive(struct libusb_transfer *transfer)
 {
        const struct sr_dev_inst *sdi;
        struct dslogic_trigger_pos *tpos;