mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-07-09 01:18:02 +02:00
Xilinx ctb (#884)
* updated registers, arm64 * compiler set to aarch64 for xilinx server * updated RegisterDefs.h * merge into generate branch and resolving conflicts and adding the xilinx changes to callerspecial and commands.yaml * compiles and can print firmware version (using a different csp0 address) * fixing other servers (gotthard, jungfrau, moench, mythen3) that it returns in case of mapping failure, xilinxctb: added that it checks type, prints proper fw version, checks kernel date, added armprocessor define to use in common places, added specifiers to supress overflow and truncation warnings * added detector ip and mac adddress to the printout * fixed tests and recompiled servers
This commit is contained in:
@ -114,6 +114,10 @@ int getTimeFromString(char *buf, time_t *result) {
|
||||
t.tm_mday, t.tm_mon, t.tm_year + 1900, t.tm_hour, t.tm_min, t.tm_sec));
|
||||
|
||||
*result = mktime(&t);
|
||||
if (*result == -1) {
|
||||
LOG(logERROR, ("Could not convert time structure to time_t\n"));
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -130,6 +134,7 @@ int getKernelVersion(char *retvals) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
int validateKernelVersion(char *expectedVersion) {
|
||||
// extract kernel date string
|
||||
char version[255] = {0};
|
||||
@ -143,15 +148,26 @@ int validateKernelVersion(char *expectedVersion) {
|
||||
#ifdef VIRTUAL
|
||||
strcpy(currentVersion, expectedVersion);
|
||||
#else
|
||||
#ifndef ARMPROCESSOR
|
||||
// remove first word (#version number)
|
||||
const char *ptr = strchr(version, ' ');
|
||||
const char *ptr = strstr(version, " ");
|
||||
if (ptr == NULL) {
|
||||
LOG(logERROR, ("Could not parse kernel version\n"));
|
||||
return FAIL;
|
||||
}
|
||||
strcpy(currentVersion, version + (ptr - version + 1));
|
||||
strcpy(currentVersion, ptr + 1);
|
||||
#else
|
||||
// remove first two words (#version number and SMP)
|
||||
const char *ptr = strstr(version, "SMP ");
|
||||
if (ptr == NULL) {
|
||||
LOG(logERROR, ("Could not parse kernel version\n"));
|
||||
return FAIL;
|
||||
}
|
||||
strcpy(currentVersion, ptr + 4);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
currentVersion[sizeof(currentVersion) - 1] = '\0';
|
||||
|
||||
// convert kernel date string into time
|
||||
time_t kernelDate;
|
||||
if (getTimeFromString(currentVersion, &kernelDate) == FAIL) {
|
||||
@ -159,6 +175,7 @@ int validateKernelVersion(char *expectedVersion) {
|
||||
("Could not parse retrieved kernel date, %s\n", currentVersion));
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logDEBUG, ("Kernel Date: [%s]\n", ctime(&kernelDate)));
|
||||
|
||||
// convert expected date into time
|
||||
time_t expDate;
|
||||
@ -167,11 +184,12 @@ int validateKernelVersion(char *expectedVersion) {
|
||||
("Could not parse expected kernel date, %s\n", expectedVersion));
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logDEBUG, ("Expected Date: [%s]\n", ctime(&expDate)));
|
||||
|
||||
// compare if kernel time is older than expected time
|
||||
if (kernelDate < expDate) {
|
||||
LOG(logERROR, ("Kernel Version Incompatible (too old)! Expected: [%s], "
|
||||
"Got [%s]\n",
|
||||
LOG(logERROR, ("Kernel Version Incompatible (too old)!\nExpected: '%s'"
|
||||
"\nGot : '%s'\n",
|
||||
expectedVersion, currentVersion));
|
||||
return FAIL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user