]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/lecroy-xstream/api.c
lecroy-xstream: Implement config_channel_set API callback
[libsigrok.git] / src / hardware / lecroy-xstream / api.c
index 2bcf2cd00567443e0c2f7ef4cd4bc8a8fe548365..8d4fe0b291eb775189535e9f8124083146d295cd 100644 (file)
@@ -227,7 +227,7 @@ static int config_set(uint32_t key, GVariant *data,
                        return SR_ERR_ARG;
                state->trigger_source = idx;
                g_snprintf(command, sizeof(command),
-                               "SET TRIGGER SOURCE %s", (*model->trigger_sources)[idx]);
+                               "TRIG_SELECT EDGE,SR,%s", (*model->trigger_sources)[idx]);
                ret = sr_scpi_send(sdi->conn, command);
                break;
        case SR_CONF_VDIV:
@@ -272,7 +272,8 @@ static int config_set(uint32_t key, GVariant *data,
                        return SR_ERR_ARG;
                state->trigger_slope = idx;
                g_snprintf(command, sizeof(command),
-                               "SET TRIGGER SLOPE %s", (*model->trigger_slopes)[idx]);
+                               "%s:TRIG_SLOPE %s", (*model->trigger_sources)[state->trigger_source],
+                               (*model->trigger_slopes)[idx]);
                ret = sr_scpi_send(sdi->conn, command);
                break;
        case SR_CONF_COUPLING:
@@ -301,6 +302,16 @@ static int config_set(uint32_t key, GVariant *data,
        return ret;
 }
 
+static int config_channel_set(const struct sr_dev_inst *sdi,
+       struct sr_channel *ch, unsigned int changes)
+{
+       /* Currently we only handle SR_CHANNEL_SET_ENABLED. */
+       if (changes != SR_CHANNEL_SET_ENABLED)
+               return SR_ERR_NA;
+
+       return lecroy_xstream_channel_state_set(sdi, ch->index, ch->enabled);
+}
+
 static int config_list(uint32_t key, GVariant **data,
                const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
 {
@@ -496,6 +507,7 @@ static struct sr_dev_driver lecroy_xstream_driver_info = {
        .dev_clear = dev_clear,
        .config_get = config_get,
        .config_set = config_set,
+       .config_channel_set = config_channel_set,
        .config_list = config_list,
        .dev_open = dev_open,
        .dev_close = dev_close,