X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fhardware%2Frigol-ds%2Fapi.c;h=58cb7cced59e206d9abe4d31c535caeabd98516b;hb=e57057aee778e723da572a6b5e2bd01526cc7beb;hp=b860c11b5d6801f22f4e3b0cb69f337d72104834;hpb=eac0c6132752224f46661ddc5a37a1e0e4694c27;p=libsigrok.git diff --git a/src/hardware/rigol-ds/api.c b/src/hardware/rigol-ds/api.c index b860c11b..58cb7cce 100644 --- a/src/hardware/rigol-ds/api.c +++ b/src/hardware/rigol-ds/api.c @@ -19,14 +19,17 @@ * along with this program. If not, see . */ +#include #include #include #include #include +#include #include #include -#include "libsigrok.h" +#include #include "libsigrok-internal.h" +#include "scpi.h" #include "protocol.h" static const uint32_t scanopts[] = { @@ -296,7 +299,7 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) } for (i = 0; i < ARRAY_SIZE(supported_models); i++) { - if (!strcasecmp(hw_info->manufacturer, + if (!g_ascii_strcasecmp(hw_info->manufacturer, supported_models[i].series->vendor->full_name) && !strcmp(hw_info->model, supported_models[i].name)) { model = &supported_models[i]; @@ -337,12 +340,12 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) } if (i != 3) break; - if (n[0] != 0 || n[1] > 2) - break; - if (n[1] == 2 && n[2] > 3) - break; - sr_dbg("Found DS1000 firmware < 0.2.4, using raw data format."); - devc->format = FORMAT_RAW; + scpi->firmware_version = n[0] * 100 + n[1] * 10 + n[2]; + if (scpi->firmware_version < 24) { + sr_dbg("Found DS1000 firmware < 0.2.4, using raw data format."); + devc->format = FORMAT_RAW; + } + break; } while (0); g_strfreev(version); } @@ -406,12 +409,12 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) static GSList *scan(struct sr_dev_driver *di, GSList *options) { - return sr_scpi_scan(di->priv, options, probe_device); + return sr_scpi_scan(di->context, options, probe_device); } static GSList *dev_list(const struct sr_dev_driver *di) { - return ((struct drv_context *)(di->priv))->instances; + return ((struct drv_context *)(di->context))->instances; } static int dev_open(struct sr_dev_inst *sdi) @@ -806,9 +809,6 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst * unsigned int i; struct dev_context *devc = NULL; - if (sdi) - devc = sdi->priv; - if (key == SR_CONF_SCAN_OPTIONS) { *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, scanopts, ARRAY_SIZE(scanopts), sizeof(uint32_t)); @@ -1090,5 +1090,5 @@ SR_PRIV struct sr_dev_driver rigol_ds_driver_info = { .dev_close = dev_close, .dev_acquisition_start = dev_acquisition_start, .dev_acquisition_stop = dev_acquisition_stop, - .priv = NULL, + .context = NULL, };