]> sigrok.org Git - libsigrok.git/commitdiff
sr: fx2lafw: Only check for correct major FW version.
authorUwe Hermann <redacted>
Wed, 30 May 2012 21:15:23 +0000 (23:15 +0200)
committerUwe Hermann <redacted>
Wed, 30 May 2012 21:23:14 +0000 (23:23 +0200)
Changes in the minor version number are OK, as those should never
contain any incompatible/API changes.

hardware/fx2lafw/fx2lafw.c
hardware/fx2lafw/fx2lafw.h

index 39f6c1f6729a0729be4d1161dbcdc6ad7d89cc95..0ea4030d7b1fcffb2f81f191275f43fa3a17fab8 100644 (file)
@@ -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;
                }
 
index 6f19b9ac93a9a356c1be01d0d3381d26ec5397c0..227854c899742b89dac71f6904628e3feb283ccb 100644 (file)
@@ -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)