X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Frigol-ds%2Fapi.c;h=1c2a2ba18b0b3489c703475a30a4dd27bd5f79ae;hb=9f42e2e6beb6f09b137501bcf402b36a64dcd211;hp=7bb67512873938c537bd81e3e3e0df515561deda;hpb=f254bc4bba68d2cade0c8f7993d8fa8d3d9b556a;p=libsigrok.git diff --git a/src/hardware/rigol-ds/api.c b/src/hardware/rigol-ds/api.c index 7bb67512..1c2a2ba1 100644 --- a/src/hardware/rigol-ds/api.c +++ b/src/hardware/rigol-ds/api.c @@ -29,27 +29,27 @@ #include "libsigrok-internal.h" #include "protocol.h" -static const uint32_t hwopts[] = { +static const uint32_t scanopts[] = { SR_CONF_CONN, SR_CONF_SERIALCOMM }; 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_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); @@ -772,7 +769,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst * if (key == SR_CONF_SCAN_OPTIONS) { *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, - hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t)); + scanopts, ARRAY_SIZE(scanopts), sizeof(uint32_t)); return SR_OK; } else if (key == SR_CONF_DEVICE_OPTIONS && cg == NULL) { *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,