From: Joel Holdsworth Date: Sun, 4 Mar 2012 14:10:05 +0000 (+0000) Subject: fx2lafw: Ensure default sample rate is set X-Git-Tag: libsigrok-0.1.0~57 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=f92994fd9174bc423e58c21eda83633afc9513da;p=libsigrok.git fx2lafw: Ensure default sample rate is set --- diff --git a/hardware/fx2lafw/fx2lafw.c b/hardware/fx2lafw/fx2lafw.c index b0bd0e60..e213df9c 100644 --- a/hardware/fx2lafw/fx2lafw.c +++ b/hardware/fx2lafw/fx2lafw.c @@ -78,6 +78,7 @@ static struct sr_samplerates fx2lafw_samplerates = { static GSList *dev_insts = NULL; static libusb_context *usb_context = NULL; +static int hw_dev_config_set(int dev_index, int hwcap, void *value); static int hw_dev_acquisition_stop(int dev_index, void *session_dev_id); /** @@ -369,6 +370,13 @@ static int hw_dev_open(int dev_index) return SR_ERR; } + if (ctx->cur_samplerate == 0) { + /* Samplerate hasn't been set; default to the slowest one. */ + if (hw_dev_config_set(dev_index, SR_HWCAP_SAMPLERATE, + &fx2lafw_supported_samplerates[0]) == SR_ERR) + return SR_ERR; + } + return SR_OK; }