jungfrau server: programfpga: handling bus error, and printing a message for user to restart servers when done in client command line

This commit is contained in:
maliakal_d 2018-05-09 15:57:18 +02:00
parent 30f1e6ad3f
commit 8986b008dd
3 changed files with 13 additions and 2 deletions

View File

@ -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)

View File

@ -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);