diff --git a/slsDetectorServers/slsDetectorServer/include/programViaBlackfin.h b/slsDetectorServers/slsDetectorServer/include/programViaBlackfin.h index 1da275577..afb76acf2 100644 --- a/slsDetectorServers/slsDetectorServer/include/programViaBlackfin.h +++ b/slsDetectorServers/slsDetectorServer/include/programViaBlackfin.h @@ -37,3 +37,4 @@ int writeToFlash(char *mess, ssize_t fsize, FILE *flashfd, FILE *srcfd); /** Notify fpga to pick up firmware from flash and wait for status confirmation */ int waitForFPGAtoTouchFlash(char *mess); +int moveBinaryFile(char *mess, char *serverName); diff --git a/slsDetectorServers/slsDetectorServer/src/programViaBlackfin.c b/slsDetectorServers/slsDetectorServer/src/programViaBlackfin.c index 3e5d8538b..7ee72c784 100644 --- a/slsDetectorServers/slsDetectorServer/src/programViaBlackfin.c +++ b/slsDetectorServers/slsDetectorServer/src/programViaBlackfin.c @@ -574,3 +574,23 @@ int waitForFPGAtoTouchFlash(char *mess) { LOG(logINFO, ("\tFPGA has picked up the program from flash\n")); return OK; } + +int moveBinaryFile(char *mess, char *serverName) { + char *format = "mv %s %s"; + if (snprintf(cmd, MAX_STR_LENGTH, format, TEMP_PROG_FILE_NAME, + serverName) >= MAX_STR_LENGTH) { + strcpy(mess, "Could not copy detector server. Command " + "to move server binary is too long\n"); + LOG(logERROR, (mess)); + return FAIL; + } + if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) { + snprintf(mess, MAX_STR_LENGTH, + "Could not copy detector server (moving). %s\n", retvals); + LOG(logERROR, (mess)); + return FAIL; + } + LOG(logINFO, ("\tmoved from temp folder to main with proper name (%s)\n", + serverName)); + return OK; +} diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index 5ba05aa54..5dccd4994 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -9381,11 +9381,7 @@ void receive_program_via_blackfin(int file_des, enum PROGRAM_INDEX index, totalsize); break; case PROGRAM_SERVER: - ret = writeBinaryFile(mess, serverName, src, totalsize); - if (ret == OK) { - ret = verifyChecksumFromFile(mess, functionType, checksum, - serverName); - } + ret = moveBinaryFile(mess, serverName); if (ret == OK) { ret = setupDetectorServer(mess, serverName); }