diff --git a/slsDetectorSoftware/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer b/slsDetectorSoftware/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer index 7ea0c44ba..6a7b9f730 100755 Binary files a/slsDetectorSoftware/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer and b/slsDetectorSoftware/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer differ diff --git a/slsDetectorSoftware/slsDetector/slsDetector.cpp b/slsDetectorSoftware/slsDetector/slsDetector.cpp index afb2bb1db..0086681d6 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetector.cpp @@ -7868,6 +7868,9 @@ int slsDetector::programFPGA(string fname){ disconnectControl(); } } + if (ret != FAIL) { + printf("You can now restart the detector servers in normal mode.\n"); + } //free resources if(fpgasrc != NULL) diff --git a/slsDetectorSoftware/slsDetectorServer/programfpga.h b/slsDetectorSoftware/slsDetectorServer/programfpga.h index c2565bf4f..b37f521de 100755 --- a/slsDetectorSoftware/slsDetectorServer/programfpga.h +++ b/slsDetectorSoftware/slsDetectorServer/programfpga.h @@ -68,6 +68,7 @@ void eraseFlash(){ printf("\nErasing Flash\n"); #endif char command[255]; + memset(command, 0, 255); sprintf(command,"flash_eraseall %s",mtdvalue); system(command); printf("Flash erased\n"); @@ -88,7 +89,14 @@ int startWritingFPGAprogram(FILE** filefp){ char output[255]; memset(output, 0, 255); FILE* fp = popen("awk \'$4== \"\\\"bitfile(spi)\\\"\" {print $1}\' /proc/mtd", "r"); - fgets(output, sizeof(output), fp); + if (fp == NULL) { + cprintf(RED,"popen returned NULL. Need that to get mtd drive.\n"); + return 1; + } + if (fgets(output, sizeof(output), fp) == NULL) { + cprintf(RED,"fgets returned NULL. Need that to get mtd drive.\n"); + return 1; + } pclose(fp); //cprintf(RED,"output: %s\n", output); memset(mtdvalue, 0, MTDSIZE); @@ -96,7 +104,7 @@ int startWritingFPGAprogram(FILE** filefp){ char* pch = strtok(output,":"); if(pch == NULL){ cprintf(RED,"Could not get mtd value\n"); - return FAIL; + return 1; } strcat(mtdvalue,pch); printf ("\nFlash drive found: %s\n",mtdvalue);