]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/rigol-ds/api.c
rigol-ds: SR_CONF_TRIGGER_SLOPE is actually listable.
[libsigrok.git] / src / hardware / rigol-ds / api.c
index e76b6b9236c14fd9dbb02ef8294786982df5852e..b9b8a7d5c92d63aaeb00991991ef5fa604cb8ffd 100644 (file)
@@ -36,20 +36,20 @@ static const uint32_t scanopts[] = {
 
 static const uint32_t devopts[] = {
        SR_CONF_OSCILLOSCOPE,
-       SR_CONF_TIMEBASE,
-       SR_CONF_TRIGGER_SOURCE,
-       SR_CONF_TRIGGER_SLOPE,
-       SR_CONF_HORIZ_TRIGGERPOS,
-       SR_CONF_NUM_TIMEBASE,
-       SR_CONF_LIMIT_FRAMES,
-       SR_CONF_SAMPLERATE,
+       SR_CONF_LIMIT_FRAMES | SR_CONF_SET,
+       SR_CONF_TIMEBASE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
+       SR_CONF_TRIGGER_SOURCE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
+       SR_CONF_TRIGGER_SLOPE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
+       SR_CONF_HORIZ_TRIGGERPOS | SR_CONF_SET,
+       SR_CONF_NUM_TIMEBASE | SR_CONF_GET,
+       SR_CONF_SAMPLERATE | SR_CONF_GET,
 };
 
 static const uint32_t analog_devopts[] = {
-       SR_CONF_NUM_VDIV,
-       SR_CONF_VDIV,
-       SR_CONF_COUPLING,
-       SR_CONF_DATA_SOURCE,
+       SR_CONF_NUM_VDIV | SR_CONF_GET,
+       SR_CONF_VDIV | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
+       SR_CONF_COUPLING | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
+       SR_CONF_DATA_SOURCE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
 };
 
 static const uint64_t timebases[][2] = {
@@ -291,22 +291,21 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
                }
        }
 
-       if (!model || !(sdi = sr_dev_inst_new(0, SR_ST_ACTIVE,
-                                             model->series->vendor->name,
-                                                 model->name,
-                                                 hw_info->firmware_version))) {
+       if (!model) {
                sr_scpi_hw_info_free(hw_info);
                return NULL;
        }
 
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
+       sdi->status = SR_ST_ACTIVE;
+       sdi->vendor = g_strdup(model->series->vendor->name);
+       sdi->model = g_strdup(model->name);
+       sdi->version = g_strdup(hw_info->firmware_version);
        sdi->conn = scpi;
-
        sdi->driver = di;
        sdi->inst_type = SR_INST_SCPI;
-
-       if (!(devc = g_try_malloc0(sizeof(struct dev_context))))
-               return NULL;
-
+       sdi->serial_num = g_strdup(hw_info->serial_number);
+       devc = g_malloc0(sizeof(struct dev_context));
        devc->limit_frames = 0;
        devc->model = model;
        devc->format = model->series->format;
@@ -362,8 +361,6 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
                                return NULL;
                        ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE, channel_name);
                        g_free(channel_name);
-                       if (!ch)
-                               return NULL;
                        sdi->channels = g_slist_append(sdi->channels, ch);
                        devc->digital_group->channels = g_slist_append(
                                        devc->digital_group->channels, ch);