Hi,
On Tue, Apr 14, 2015 at 11:29:49PM -0700, Carl-Fredrik Sundström wrote:
> My first attempt at using git and creating a patch for some small
> incremental DSLogic support.
Thanks, quick review below.
Please try to send patches generated by you locally committing them (so
that they have a good commit message, and the author's name + email).
Once committed you can create a proper patch file like this:
git format-patch HEAD~1
(replace "1" with e.g. "5" to get the last five commits as patch files)
> diff --git a/src/hardware/fx2lafw/api.c b/src/hardware/fx2lafw/api.c
> index 04284e5..e1c830d 100644
> --- a/src/hardware/fx2lafw/api.c
> +++ b/src/hardware/fx2lafw/api.c
> @@ -20,6 +20,9 @@
>
> #include "protocol.h"
> #include "dslogic.h"
> +#include "libsigrok.h"
> +#include "libsigrok-internal.h"
> +
>
> static const struct fx2lafw_profile supported_fx2[] = {
> /*
> @@ -519,6 +522,18 @@ static int config_set(uint32_t key, GVariant *data,
> const struct sr_dev_inst *sd
> switch (key) {
> case SR_CONF_SAMPLERATE:
> arg = g_variant_get_uint64(data);
> +
> + if(strcmp(sdi->model, "DSLogic") == 0 && strcmp(sdi->vendor,
> "DreamSourceLab") == 0) {
> + for (i = 0; i < ARRAY_SIZE(dslogic_samplerates); i++) {
> + if (dslogic_samplerates[i] == arg) {
> + devc->cur_samplerate = arg;
> + break;
> + }
> + }
> + if (i == ARRAY_SIZE(dslogic_samplerates))
> + ret = SR_ERR_ARG;
> + }
Yup, the handling seems hardcoded for fx2lafw here, but there's a
simpler fix for this.
You can generally use the boolean "devc->dslogic" (will be true if it's
a DSLogic device, false if it's another FX2 based device. But in this
case that won't be needed either, you can simply use devc->samplerates
and devc->num_samplerates in all cases (those are correctly set for
both device types) and only one code path will be needed.
> --- a/src/hardware/fx2lafw/protocol.h
> +++ b/src/hardware/fx2lafw/protocol.h
> @@ -55,8 +55,8 @@
>
> /* Protocol commands */
> #define CMD_GET_FW_VERSION 0xb0
> -#define CMD_START 0xb1
> -#define CMD_GET_REVID_VERSION 0xb2
> +#define CMD_GET_REVID_VERSION 0xb1
> +#define CMD_START 0xb2
This shouldn't be needed, protocol.h has the fx2lafw commands, the
DSLogic-specific ones in dslogic.h seem correct (haven't checked whether
those are actually used though).
Uwe.
--
http://hermann-uwe.de | http://randomprojects.org | http://sigrok.org
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
sigrok-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sigrok-devel