X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Ffx2lafw%2Ffx2lafw.c;h=fb673d675ac784725cf7e20f78a61bdc49230a6d;hb=7ec5b54955118d8c1ee003a02c3334f1a0046457;hp=a76ffd577653cc6bd3bb193607d17f6ecf01c5d1;hpb=a1c743fc51d7b49c769fb525fe4b89985a9468c9;p=libsigrok.git diff --git a/hardware/fx2lafw/fx2lafw.c b/hardware/fx2lafw/fx2lafw.c index a76ffd57..fb673d67 100644 --- a/hardware/fx2lafw/fx2lafw.c +++ b/hardware/fx2lafw/fx2lafw.c @@ -118,10 +118,10 @@ static const uint64_t supported_samplerates[] = { }; static const struct sr_samplerates samplerates = { - 0, - 0, - 0, - supported_samplerates, + .low = 0, + .high = 0, + .step = 0, + .list = supported_samplerates, }; SR_PRIV struct sr_dev_driver fx2lafw_driver_info; @@ -384,17 +384,7 @@ static int clear_instances(void) static int hw_init(struct sr_context *sr_ctx) { - struct drv_context *drvc; - - if (!(drvc = g_try_malloc0(sizeof(struct drv_context)))) { - sr_err("Driver context malloc failed."); - return SR_ERR_MALLOC; - } - - drvc->sr_ctx = sr_ctx; - di->priv = drvc; - - return SR_OK; + return std_hw_init(sr_ctx, di, DRIVER_LOG_DOMAIN); } static GSList *hw_scan(GSList *options) @@ -607,16 +597,7 @@ static int config_get(int id, const void **data, const struct sr_dev_inst *sdi) struct dev_context *devc; switch (id) { - case SR_DI_HWCAPS: - *data = hwcaps; - break; - case SR_DI_SAMPLERATES: - *data = &samplerates; - break; - case SR_DI_TRIGGER_TYPES: - *data = TRIGGER_TYPES; - break; - case SR_DI_CUR_SAMPLERATE: + case SR_CONF_SAMPLERATE: if (sdi) { devc = sdi->priv; *data = &devc->cur_samplerate; @@ -656,9 +637,15 @@ static int config_list(int key, const void **data, const struct sr_dev_inst *sdi (void)sdi; switch (key) { + case SR_CONF_DEVICE_OPTIONS: + *data = hwcaps; + break; case SR_CONF_SAMPLERATE: *data = &samplerates; break; + case SR_CONF_TRIGGER_TYPE: + *data = TRIGGER_TYPE; + break; default: return SR_ERR_ARG; }