From: Uwe Hermann Date: Wed, 30 May 2012 21:15:23 +0000 (+0200) Subject: sr: fx2lafw: Only check for correct major FW version. X-Git-Tag: libsigrok-0.1.1~1 X-Git-Url: https://sigrok.org/gitweb/?a=commitdiff_plain;h=0a8c0c324e16e4848498309dbb2efd27b4c812a9;hp=8fdecced96a1e849f5474e57aeca456dd265d9b9;p=libsigrok.git sr: fx2lafw: Only check for correct major FW version. Changes in the minor version number are OK, as those should never contain any incompatible/API changes. --- diff --git a/hardware/fx2lafw/fx2lafw.c b/hardware/fx2lafw/fx2lafw.c index 39f6c1f6..0ea4030d 100644 --- a/hardware/fx2lafw/fx2lafw.c +++ b/hardware/fx2lafw/fx2lafw.c @@ -251,11 +251,15 @@ static int fx2lafw_dev_open(int dev_index) break; } - if (vi.major != FX2LAFW_VERSION_MAJOR || - vi.minor != FX2LAFW_VERSION_MINOR) { - sr_err("fx2lafw: Expected firmware version %d.%d " - "got %d.%d.", FX2LAFW_VERSION_MAJOR, - FX2LAFW_VERSION_MINOR, vi.major, vi.minor); + /* + * Changes in major version mean incompatible/API changes, so + * bail out if we encounter an incompatible version. + * Different minor versions are OK, they should be compatible. + */ + if (vi.major != FX2LAFW_REQUIRED_VERSION_MAJOR) { + sr_err("fx2lafw: Expected firmware version %d.x, " + "got %d.%d.", FX2LAFW_REQUIRED_VERSION_MAJOR, + vi.major, vi.minor); break; } diff --git a/hardware/fx2lafw/fx2lafw.h b/hardware/fx2lafw/fx2lafw.h index 6f19b9ac..227854c8 100644 --- a/hardware/fx2lafw/fx2lafw.h +++ b/hardware/fx2lafw/fx2lafw.h @@ -31,8 +31,7 @@ #define NUM_SIMUL_TRANSFERS 32 #define MAX_EMPTY_TRANSFERS (NUM_SIMUL_TRANSFERS * 2) -#define FX2LAFW_VERSION_MAJOR 1 -#define FX2LAFW_VERSION_MINOR 0 +#define FX2LAFW_REQUIRED_VERSION_MAJOR 1 /* 6 delay states of up to 256 clock ticks */ #define MAX_SAMPLE_DELAY (6 * 256)