X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Flink-mso19%2Fapi.c;h=46270ffeb7fed89836e65cd3d295f8f6123b33d8;hb=c368e6f3d248a73d69cd0c2c4a7c88a92def55e3;hp=829530e028d7ff7ea351b15fff6113070abb6e9c;hpb=584560f142e1b17b9f4ef9069bd3724f2f77e750;p=libsigrok.git diff --git a/src/hardware/link-mso19/api.c b/src/hardware/link-mso19/api.c index 829530e0..46270ffe 100644 --- a/src/hardware/link-mso19/api.c +++ b/src/hardware/link-mso19/api.c @@ -21,16 +21,16 @@ #include "protocol.h" -static const uint32_t hwcaps[] = { +static const uint32_t devopts[] = { SR_CONF_OSCILLOSCOPE, SR_CONF_LOGIC_ANALYZER, - SR_CONF_SAMPLERATE, - SR_CONF_TRIGGER_TYPE, - SR_CONF_TRIGGER_SLOPE, - SR_CONF_HORIZ_TRIGGERPOS, -// SR_CONF_CAPTURE_RATIO, - SR_CONF_LIMIT_SAMPLES, -// SR_CONF_RLE, + SR_CONF_LIMIT_SAMPLES | SR_CONF_SET, + SR_CONF_SAMPLERATE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, + SR_CONF_TRIGGER_TYPE | SR_CONF_LIST, + SR_CONF_TRIGGER_SLOPE | SR_CONF_SET, + SR_CONF_HORIZ_TRIGGERPOS | SR_CONF_SET, + SR_CONF_CAPTURE_RATIO | SR_CONF_SET, + SR_CONF_RLE | SR_CONF_SET, }; /* @@ -178,10 +178,7 @@ static GSList *scan(GSList *options) //Create the device context and set its params struct dev_context *devc; - if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) { - sr_err("Device context malloc failed."); - return devices; - } + devc = g_malloc0(sizeof(struct dev_context)); if (mso_parse_serial(iSerial, iProduct, devc) != SR_OK) { sr_err("Invalid iSerial: %s.", iSerial); @@ -203,8 +200,11 @@ static GSList *scan(GSList *options) return devices; } - struct sr_dev_inst *sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, - manufacturer, product, hwrev); + struct sr_dev_inst *sdi = g_malloc0(sizeof(struct sr_dev_inst)); + sdi->status = SR_ST_INACTIVE; + sdi->vendor = g_strdup(manufacturer); + sdi->model = g_strdup(product); + sdi->version = g_strdup(hwrev); if (!sdi) { sr_err("Unable to create device instance for %s", @@ -220,9 +220,8 @@ static GSList *scan(GSList *options) for (i = 0; i < NUM_CHANNELS; i++) { struct sr_channel *ch; chtype = (i == 0) ? SR_CHANNEL_ANALOG : SR_CHANNEL_LOGIC; - if (!(ch = sr_channel_new(i, chtype, TRUE, - mso19_channel_names[i]))) - return 0; + ch = sr_channel_new(i, chtype, TRUE, + mso19_channel_names[i]); sdi->channels = g_slist_append(sdi->channels, ch); } @@ -381,7 +380,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_DEVICE_OPTIONS: *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t)); + devopts, ARRAY_SIZE(devopts), sizeof(uint32_t)); break; case SR_CONF_SAMPLERATE: g_variant_builder_init(&gvb, G_VARIANT_TYPE("a{sv}"));