mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
wip
This commit is contained in:
@ -72,9 +72,10 @@ int preparetoCopyFPGAProgram(FILE **fd, uint64_t fsize, char *mess) {
|
|||||||
char retvals[MAX_STR_LENGTH] = {0};
|
char retvals[MAX_STR_LENGTH] = {0};
|
||||||
sprintf(cmd, "rm -fr %s", TEMP_PROG_FILE_NAME);
|
sprintf(cmd, "rm -fr %s", TEMP_PROG_FILE_NAME);
|
||||||
if (FAIL == executeCommand(cmd, retvals, logDEBUG1)) {
|
if (FAIL == executeCommand(cmd, retvals, logDEBUG1)) {
|
||||||
sprintf(mess,
|
strcpy(mess,
|
||||||
"Could not program fpga. (could not delete old file: %s)",
|
"Could not program fpga. (could not delete old file: ");
|
||||||
retvals);
|
strncat(mess, retvals, sizeof(mess) - strlen(mess) - 1);
|
||||||
|
strcat(mess, "\n");
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@ -155,16 +156,18 @@ int getDrive(char *mess) {
|
|||||||
char retvals[MAX_STR_LENGTH] = {0};
|
char retvals[MAX_STR_LENGTH] = {0};
|
||||||
sprintf(cmd, "rm -fr %s", TEMP_PROG_FILE_NAME);
|
sprintf(cmd, "rm -fr %s", TEMP_PROG_FILE_NAME);
|
||||||
if (FAIL == executeCommand(cmd, retvals, logDEBUG1)) {
|
if (FAIL == executeCommand(cmd, retvals, logDEBUG1)) {
|
||||||
sprintf(mess, "Could not program fpga. (could not delete old file: %s)",
|
strcpy(mess, "Could not program fpga. (could not delete old file: ");
|
||||||
retvals);
|
strncat(mess, retvals, sizeof(mess) - strlen(mess) - 1);
|
||||||
|
strcat(mess, "\n");
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(retvals, 0, MAX_STR_LENGTH);
|
memset(retvals, 0, MAX_STR_LENGTH);
|
||||||
if (executeCommand(CMD_GET_FLASH, retvals, logDEBUG1) == FAIL) {
|
if (executeCommand(CMD_GET_FLASH, retvals, logDEBUG1) == FAIL) {
|
||||||
sprintf(mess, "Could not program fpga. (could not get flash drive: %s)",
|
strcpy(mess, "Could not program fpga. (could not get flash drive: ");
|
||||||
retvals);
|
strncat(mess, retvals, sizeof(mess) - strlen(mess) - 1);
|
||||||
|
strcat(mess, "\n");
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@ -220,8 +223,9 @@ int eraseFlash(char *mess) {
|
|||||||
char retvals[MAX_STR_LENGTH] = {0};
|
char retvals[MAX_STR_LENGTH] = {0};
|
||||||
sprintf(cmd, "flash_eraseall %s", flashDriveName);
|
sprintf(cmd, "flash_eraseall %s", flashDriveName);
|
||||||
if (FAIL == executeCommand(cmd, retvals, logDEBUG1)) {
|
if (FAIL == executeCommand(cmd, retvals, logDEBUG1)) {
|
||||||
sprintf(mess, "Could not program fpga. (could not erase flash: %s)",
|
strcpy(mess, "Could not program fpga. (could not erase flash: ");
|
||||||
retvals);
|
strncat(mess, retvals, sizeof(mess) - strlen(mess) - 1);
|
||||||
|
strcat(mess, "\n");
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@ -293,8 +297,10 @@ int waitForFPGAtoTouchFlash(char* mess) {
|
|||||||
// read gpio status
|
// read gpio status
|
||||||
char retvals[MAX_STR_LENGTH] = {0};
|
char retvals[MAX_STR_LENGTH] = {0};
|
||||||
if (FAIL == executeCommand(CMD_FPGA_PICKED_STATUS, retvals, logDEBUG1)) {
|
if (FAIL == executeCommand(CMD_FPGA_PICKED_STATUS, retvals, logDEBUG1)) {
|
||||||
sprintf(mess, "Could not program fpga. (could not read gpio status: %s)\n",
|
strcpy(mess,
|
||||||
retvals);
|
"Could not program fpga. (could not read gpio status: ");
|
||||||
|
strncat(mess, retvals, sizeof(mess) - strlen(mess) - 1);
|
||||||
|
strcat(mess, "\n");
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
@ -461,6 +461,7 @@ int executeCommand(char *command, char *result, enum TLogLevel level) {
|
|||||||
strncat(result, temp, tempsize);
|
strncat(result, temp, tempsize);
|
||||||
memset(temp, 0, tempsize);
|
memset(temp, 0, tempsize);
|
||||||
}
|
}
|
||||||
|
result[MAX_STR_LENGTH - 1] = '\0';
|
||||||
int sucess = pclose(sysFile);
|
int sucess = pclose(sysFile);
|
||||||
if (strlen(result)) {
|
if (strlen(result)) {
|
||||||
if (sucess) {
|
if (sucess) {
|
||||||
@ -3803,10 +3804,10 @@ int program_fpga(int file_des) {
|
|||||||
char retvals[MAX_STR_LENGTH] = {0};
|
char retvals[MAX_STR_LENGTH] = {0};
|
||||||
strcpy(cmd, "ls -lrt /var/tmp/");
|
strcpy(cmd, "ls -lrt /var/tmp/");
|
||||||
if (FAIL == executeCommand(cmd, retvals, logINFO)) {
|
if (FAIL == executeCommand(cmd, retvals, logINFO)) {
|
||||||
sprintf(
|
strcpy(mess,
|
||||||
mess,
|
"Could not program fpga. Could not delete old file: ");
|
||||||
"Could not program fpga. (could not delete old file: %s)",
|
strncat(mess, retvals, sizeof(mess) - strlen(mess) - 1);
|
||||||
retvals);
|
strcat(mess, "\n");
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user