mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-20 02:40:03 +02:00
adding the check for copydetector server and updatemode (also for any kind of updatedetectorserver, programfpga and updatekernel)
This commit is contained in:
parent
ed2e6e4e28
commit
f39f93b2c8
@ -14,7 +14,7 @@ int FPGATouchFlash(char *mess);
|
|||||||
int resetFPGA(char *mess);
|
int resetFPGA(char *mess);
|
||||||
|
|
||||||
int emptyTempFolder(char *mess);
|
int emptyTempFolder(char *mess);
|
||||||
int allowKernelUpdate(char *mess, char *functionType);
|
int allowUpdate(char *mess, char *functionType);
|
||||||
/**
|
/**
|
||||||
* deletes old file
|
* deletes old file
|
||||||
* verify memory available to copy
|
* verify memory available to copy
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include <sys/sysinfo.h>
|
#include <sys/sysinfo.h>
|
||||||
#include <unistd.h> // usleep
|
#include <unistd.h> // usleep
|
||||||
|
|
||||||
|
#define BLACKFIN_DEFINED
|
||||||
/* global variables */
|
/* global variables */
|
||||||
// clang-format off
|
// clang-format off
|
||||||
#define MAX_TIME_FPGA_TOUCH_FLASH_US (10 * 1000 * 1000) // 10s
|
#define MAX_TIME_FPGA_TOUCH_FLASH_US (10 * 1000 * 1000) // 10s
|
||||||
@ -248,8 +249,8 @@ int emptyTempFolder(char *mess) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int allowKernelUpdate(char *mess, char *functionType) {
|
int allowUpdate(char *mess, char *functionType) {
|
||||||
LOG(logINFO, ("\tVerifying kernel update allowed...\n"));
|
LOG(logINFO, ("\tVerifying %s allowed...\n", functionType));
|
||||||
|
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return OK;
|
return OK;
|
||||||
|
@ -4143,7 +4143,13 @@ 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};
|
||||||
|
|
||||||
|
#if 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;
|
||||||
@ -4153,11 +4159,13 @@ int copy_detector_server(int file_des) {
|
|||||||
} else if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
|
} else if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
snprintf(mess, MAX_STR_LENGTH,
|
snprintf(mess, MAX_STR_LENGTH,
|
||||||
"Could not copy detector server (tftp). %s\n", retvals);
|
"Could not copy detector server (tftp). %s\n",
|
||||||
|
retvals);
|
||||||
// LOG(logERROR, (mess)); already printed in executecommand
|
// LOG(logERROR, (mess)); already printed in executecommand
|
||||||
} 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);
|
||||||
@ -9373,8 +9381,8 @@ void receive_program_via_blackfin(int file_des, enum PROGRAM_INDEX index,
|
|||||||
functionType);
|
functionType);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
#else
|
#else
|
||||||
// check kernel update is allowed (Non Amd OR AMD + current kernel)
|
// check update is allowed (Non Amd OR AMD + current kernel)
|
||||||
ret = allowKernelUpdate(mess, functionType);
|
ret = allowUpdate(mess, functionType);
|
||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
Server_SendResult(file_des, INT32, NULL, 0);
|
Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
return;
|
return;
|
||||||
@ -9599,6 +9607,12 @@ 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));
|
||||||
|
|
||||||
|
#if BLACKFIN_DEFINED
|
||||||
|
// check update is allowed (Non Amd OR AMD + current kernel)
|
||||||
|
ret = allowUpdate(mess, "copy detector server");
|
||||||
|
#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");
|
||||||
@ -9612,6 +9626,7 @@ 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);
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user