removed the test for allow update for kernel and server as it is eligible if the kernel is booting up anyway

This commit is contained in:
maliakal_d 2022-11-11 16:02:17 +01:00
parent 7f8b5ac6c0
commit 83e0eb8b01
17 changed files with 26 additions and 90 deletions

View File

@ -1 +0,0 @@
../slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServerv6.1.0

View File

@ -1 +0,0 @@
../slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServerv6.1.0

View File

@ -1 +0,0 @@
../slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv6.1.1

View File

@ -1 +0,0 @@
../slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv6.1.0

View File

@ -16,7 +16,6 @@ int FPGATouchFlash(char *mess, int programming);
int resetFPGA(char *mess); int resetFPGA(char *mess);
int emptyTempFolder(char *mess); int emptyTempFolder(char *mess);
int allowUpdate(char *mess, char *functionType);
/** /**
* deletes old file * deletes old file
* verify memory available to copy * verify memory available to copy

View File

@ -254,41 +254,6 @@ int emptyTempFolder(char *mess) {
#endif #endif
} }
int allowUpdate(char *mess, char *functionType) {
LOG(logINFO, ("\tVerifying %s allowed...\n", functionType));
#ifdef VIRTUAL
return OK;
#endif
char retvals[MAX_STR_LENGTH] = {0};
if (executeCommand(CMD_GET_AMD_FLASH, retvals, logDEBUG1) == FAIL) {
// no amd found
if (strstr(retvals, "No result") != NULL) {
LOG(logINFO, ("\tNot Amd Flash\n"));
return OK;
}
// could not figure out if amd
snprintf(
mess, MAX_STR_LENGTH,
"Could not update %s. (Could not figure out if Amd flash: %s)\n",
functionType, retvals);
LOG(logERROR, (mess));
return FAIL;
}
// amd, only current kernel works with amd flash
if (validateKernelVersion(KERNEL_DATE_VRSN_3GPIO) == FAIL) {
getKernelVersion(retvals);
snprintf(mess, MAX_STR_LENGTH,
"Could not update %s. Kernel version %s is too old to "
"update the Amd flash/ root directory. Most likely, blackfin needs rescue or replacement. Please contact us.\n",
functionType, retvals);
LOG(logERROR, (mess));
return FAIL;
}
LOG(logINFO, ("\tAmd flash with compatible kernel version\n"));
return OK;
}
int preparetoCopyProgram(char *mess, char *functionType, FILE **fd, int preparetoCopyProgram(char *mess, char *functionType, FILE **fd,
uint64_t fsize) { uint64_t fsize) {

View File

@ -4143,13 +4143,7 @@ int copy_detector_server(int file_des) {
LOG(logINFOBLUE, ("Copying server %s from host %s\n", sname, hostname)); LOG(logINFOBLUE, ("Copying server %s from host %s\n", sname, hostname));
char cmd[MAX_STR_LENGTH] = {0}; char cmd[MAX_STR_LENGTH] = {0};
#ifdef BLACKFIN_DEFINED
// check update is allowed (Non Amd OR AMD + current kernel)
ret = allowUpdate(mess, "copy detector server");
#endif
// tftp server // tftp server
if (ret == OK) {
if (snprintf(cmd, MAX_STR_LENGTH, "tftp %s -r %s -g", hostname, if (snprintf(cmd, MAX_STR_LENGTH, "tftp %s -r %s -g", hostname,
sname) >= MAX_STR_LENGTH) { sname) >= MAX_STR_LENGTH) {
ret = FAIL; ret = FAIL;
@ -4165,7 +4159,6 @@ int copy_detector_server(int file_des) {
} else { } else {
LOG(logINFO, ("\tServer copied\n")); LOG(logINFO, ("\tServer copied\n"));
} }
}
if (ret == OK) { if (ret == OK) {
ret = setupDetectorServer(mess, sname); ret = setupDetectorServer(mess, sname);
@ -9403,16 +9396,6 @@ void receive_program_via_blackfin(int file_des, enum PROGRAM_INDEX index,
functionType); functionType);
LOG(logERROR, (mess)); LOG(logERROR, (mess));
#else #else
// only when writing to kernel flash or root directory
if (index != PROGRAM_FPGA) {
// check update is allowed (Non Amd OR AMD + current kernel)
ret = allowUpdate(mess, functionType);
if (ret == FAIL) {
Server_SendResult(file_des, INT32, NULL, 0);
return;
}
}
// open file and allocate memory for part program // open file and allocate memory for part program
FILE *fd = NULL; FILE *fd = NULL;
ret = preparetoCopyProgram(mess, functionType, &fd, filesize); ret = preparetoCopyProgram(mess, functionType, &fd, filesize);
@ -9632,12 +9615,6 @@ int set_update_mode(int file_des) {
return printSocketReadError(); return printSocketReadError();
LOG(logDEBUG1, ("Setting update mode to \n", arg)); LOG(logDEBUG1, ("Setting update mode to \n", arg));
#ifdef BLACKFIN_DEFINED
// check update is allowed (Non Amd OR AMD + current kernel)
ret = allowUpdate(mess, "set/unset update mode");
#endif
if (ret == OK) {
switch (arg) { switch (arg) {
case 0: case 0:
ret = deleteFile(mess, UPDATE_FILE, "unset update mode"); ret = deleteFile(mess, UPDATE_FILE, "unset update mode");
@ -9651,7 +9628,6 @@ int set_update_mode(int file_des) {
LOG(logERROR, (mess)); LOG(logERROR, (mess));
break; break;
} }
}
return Server_SendResult(file_des, INT32, NULL, 0); return Server_SendResult(file_des, INT32, NULL, 0);
} }