fix to allowing update mode functions in update mode and removing exception about set_position for hostname in update mode

This commit is contained in:
2021-11-16 09:55:29 +01:00
parent eb69d7cb69
commit 904af4de06
4 changed files with 24 additions and 17 deletions

View File

@ -8,13 +8,12 @@
#include <sys/types.h> #include <sys/types.h>
#include <time.h> #include <time.h>
#define UPDATE_FILE "update.txt"
#ifdef VIRTUAL #ifdef VIRTUAL
#define TEMP_PROG_FOLDER_NAME "/tmp/" #define TEMP_PROG_FOLDER_NAME "/tmp/"
#define UPDATE_FILE "/tmp/slsdet_udpate"
#else #else
#define TEMP_PROG_FOLDER_NAME "/var/tmp/" #define TEMP_PROG_FOLDER_NAME "/var/tmp/"
#define TEMP_PROG_FOLDER_NAME_ALL_FILES "/var/tmp/*" #define TEMP_PROG_FOLDER_NAME_ALL_FILES "/var/tmp/*"
#define UPDATE_FILE "udpate.txt"
#endif #endif
#define TEMP_PROG_FILE_NAME TEMP_PROG_FOLDER_NAME "tmp.rawbin" #define TEMP_PROG_FILE_NAME TEMP_PROG_FOLDER_NAME "tmp.rawbin"

View File

@ -49,18 +49,6 @@ int main(int argc, char *argv[]) {
checkModuleFlag = 1; checkModuleFlag = 1;
int version = 0; int version = 0;
// update flag if update file exists (command line arg overwrites)
const int fileNameSize = 128;
char fname[fileNameSize];
if (getAbsPath(fname, fileNameSize, UPDATE_FILE) == FAIL) {
LOG(logERROR, ("Could not get abs path to check if update file exists. "
"Will try current folder instead.\n"));
strcpy(fname, UPDATE_FILE);
}
if (access(fname, F_OK) == 0) {
updateFlag = 1;
}
// help message // help message
char helpMessage[MAX_STR_LENGTH]; char helpMessage[MAX_STR_LENGTH];
memset(helpMessage, 0, MAX_STR_LENGTH); memset(helpMessage, 0, MAX_STR_LENGTH);
@ -163,7 +151,7 @@ int main(int argc, char *argv[]) {
break; break;
case 'u': case 'u':
LOG(logINFO, ("Detected update mode\n")); LOG(logINFO, ("Detected update mode from command line\n"));
updateFlag = 1; updateFlag = 1;
break; break;
@ -198,6 +186,24 @@ int main(int argc, char *argv[]) {
if (sharedMemory_create(portno) == FAIL) { if (sharedMemory_create(portno) == FAIL) {
return -1; return -1;
} }
if (updateFlag == 0) {
// update flag if update file exists (command line arg overwrites)
const int fileNameSize = 128;
char fname[fileNameSize];
if (getAbsPath(fname, fileNameSize, UPDATE_FILE) == FAIL) {
LOG(logERROR,
("Could not get abs path to check if update file exists. "
"Will try current folder instead.\n"));
strcpy(fname, UPDATE_FILE);
}
if (access(fname, F_OK) == 0) {
updateFlag = 1;
LOG(logINFOBLUE, ("File Found: Update Mode enabled\n"));
} else {
LOG(logINFOBLUE, ("File not Found: Update Mode diabled\n"));
}
}
#ifdef STOP_SERVER #ifdef STOP_SERVER
// start stop server process // start stop server process
char cmd[MAX_STR_LENGTH]; char cmd[MAX_STR_LENGTH];

View File

@ -78,7 +78,7 @@ char scanErrMessage[MAX_STR_LENGTH] = "";
/* initialization functions */ /* initialization functions */
int updateModeAllowedFunction(int file_des) { int updateModeAllowedFunction(int file_des) {
unsigned int listsize = 17; unsigned int listsize = 19;
enum detFuncs list[] = {F_EXEC_COMMAND, enum detFuncs list[] = {F_EXEC_COMMAND,
F_GET_DETECTOR_TYPE, F_GET_DETECTOR_TYPE,
F_GET_FIRMWARE_VERSION, F_GET_FIRMWARE_VERSION,

View File

@ -338,7 +338,9 @@ void DetectorImpl::updateDetectorSize() {
<< shm()->numberOfChannels.y; << shm()->numberOfChannels.y;
for (auto &module : modules) { for (auto &module : modules) {
module->updateNumberOfModule(shm()->numberOfModule); if (module->getUpdateMode() == 0) {
module->updateNumberOfModule(shm()->numberOfModule);
}
} }
} }