mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 07:20:01 +02:00
servers: removing notification file as this will be done by daemon
This commit is contained in:
parent
395b9f1b72
commit
3514b14bc9
@ -324,7 +324,6 @@ u_int32_t getDetectorIP() {
|
||||
/* initialization */
|
||||
|
||||
void initControlServer() {
|
||||
CreateNotificationForCriticalTasks();
|
||||
if (initError == OK) {
|
||||
setupDetector();
|
||||
}
|
||||
|
@ -315,7 +315,6 @@ u_int32_t getDetectorIP() {
|
||||
/* initialization */
|
||||
|
||||
void initControlServer() {
|
||||
CreateNotificationForCriticalTasks();
|
||||
if (initError == OK) {
|
||||
setupDetector();
|
||||
}
|
||||
|
@ -8,16 +8,6 @@
|
||||
/** Notify microcontroller of successful server start up */
|
||||
void NotifyServerStartSuccess();
|
||||
|
||||
/** create notification file to notify watchdog of critical tasks (to not
|
||||
* shutdown) */
|
||||
void CreateNotificationForCriticalTasks();
|
||||
|
||||
/** write 1 to notification file to postpone shut down process if requested*/
|
||||
void NotifyCriticalTask();
|
||||
|
||||
/** write 0 to notification file to allow shut down process if requested */
|
||||
void NotifyCriticalTaskDone();
|
||||
|
||||
/** reset fpga and controller(only implemented for >= v1.1 boards) */
|
||||
void rebootControllerAndFPGA();
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
/* global variables */
|
||||
#define MTDSIZE 10
|
||||
char mtdvalue[MTDSIZE] = {0};
|
||||
#define NOTIFICATION_FILE "/tmp/block_shutdown"
|
||||
#define MICROCONTROLLER_FILE "/dev/ttyAL0"
|
||||
|
||||
void NotifyServerStartSuccess() {
|
||||
@ -20,38 +19,6 @@ void NotifyServerStartSuccess() {
|
||||
system(command);
|
||||
}
|
||||
|
||||
void CreateNotificationForCriticalTasks() {
|
||||
FILE *fd = fopen(NOTIFICATION_FILE, "r");
|
||||
if (fd == NULL) {
|
||||
fd = fopen(NOTIFICATION_FILE, "w");
|
||||
if (fd == NULL) {
|
||||
LOG(logERROR,
|
||||
("Could not create notication file: %s\n", NOTIFICATION_FILE));
|
||||
return;
|
||||
}
|
||||
LOG(logINFOBLUE,
|
||||
("Created notification file: %s\n", NOTIFICATION_FILE));
|
||||
}
|
||||
fclose(fd);
|
||||
NotifyCriticalTaskDone();
|
||||
}
|
||||
|
||||
void NotifyCriticalTask() {
|
||||
LOG(logINFO, ("\tNotifying Critical Task Ongoing\n"));
|
||||
char command[255];
|
||||
memset(command, 0, 255);
|
||||
sprintf(command, "echo 1 > %s", NOTIFICATION_FILE);
|
||||
system(command);
|
||||
}
|
||||
|
||||
void NotifyCriticalTaskDone() {
|
||||
LOG(logINFO, ("\tNotifying Critical Task Done\n"));
|
||||
char command[255];
|
||||
memset(command, 0, 255);
|
||||
sprintf(command, "echo 0 > %s", NOTIFICATION_FILE);
|
||||
system(command);
|
||||
}
|
||||
|
||||
void rebootControllerAndFPGA() {
|
||||
LOG(logDEBUG1, ("Reseting FPGA...\n"));
|
||||
char command[255];
|
||||
@ -111,13 +78,11 @@ int eraseAndWriteToFlash(char *mess, char *fpgasrc, uint64_t fsize) {
|
||||
if (findFlash(mess) == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
NotifyCriticalTask();
|
||||
eraseFlash();
|
||||
|
||||
// open file pointer to flash
|
||||
FILE *filefp = fopen(mtdvalue, "w");
|
||||
if (filefp == NULL) {
|
||||
NotifyCriticalTaskDone();
|
||||
sprintf(mess, "Unable to open %s in write mode\n", mtdvalue);
|
||||
LOG(logERROR, (mess));
|
||||
return FAIL;
|
||||
@ -126,13 +91,11 @@ int eraseAndWriteToFlash(char *mess, char *fpgasrc, uint64_t fsize) {
|
||||
|
||||
// write to flash
|
||||
if (writeFPGAProgram(mess, fpgasrc, fsize, filefp) == FAIL) {
|
||||
NotifyCriticalTaskDone();
|
||||
fclose(filefp);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
fclose(filefp);
|
||||
NotifyCriticalTaskDone();
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user