]> jspc29.x-matter.uni-frankfurt.de Git - trbnettools.git/commitdiff
fixed stringId bug
authorhadaq <hadaq>
Tue, 12 Jun 2012 16:00:02 +0000 (16:00 +0000)
committerhadaq <hadaq>
Tue, 12 Jun 2012 16:00:02 +0000 (16:00 +0000)
libtrbnet/trbflash.c

index 85bd0f8034335a752579670dd0c83a048fcfa491..aacd2f339b36aaad6311c631d3a4ddde1252c8b9 100644 (file)
@@ -120,7 +120,7 @@ typedef struct {
 } FlashParam;
 
 static FlashParam flashParamRef;
-static const char trbflash_version[] = "$Revision: 2.39 $";
+static const char trbflash_version[] = "$Revision: 2.40 $";
 
 static uint32_t mdcFlashSelect = 1;
 
@@ -1077,16 +1077,20 @@ static int prepareImageBuffer()
     while (strlen(flashParamRef.allowedStringId[j]) > 0) {
       if (memcmp(imageBuffer + i, 
                  flashParamRef.allowedStringId[j], 
-                 strlen(flashParamRef.allowedStringId[j]))) {
+                 strlen(flashParamRef.allowedStringId[j])) == 0) {
         match = 1;
         break;
       }
+      j++;
     }
   }
   
   if ((skipFirmwareIdCheck == 0) && (match == 0)) {
     fprintf(logFile, "Error > prepareImageBuffer: "
-            "invalid Firmware-Id of Image-File\n");
+            "invalid Firmware-Id of Image-File, should be one of:\n");
+    for (i = 0; strlen(flashParamRef.allowedStringId[i]) > 0; i++) {
+      fprintf(logFile, "         %s\n", flashParamRef.allowedStringId[i]);
+    }
     return -1;
   }
   
@@ -1570,7 +1574,8 @@ int main(int argc, char **argv)
     }
 
     /* In case of MDC: select FlashRom */
-    if ((flashParamRef.flashType == FLASH_MDC_OEP_V2) || (flashParamRef.flashType == FLASH_MDC_OEP_V3)) {
+    if ((flashParamRef.flashType == FLASH_MDC_OEP_V2) ||
+        (flashParamRef.flashType == FLASH_MDC_OEP_V3)) {
       if (selectMdcFlashRom(trb_address, mdcFlashSelect) == -1) {
         exit(EXIT_FAILURE);
       }