server works

This commit is contained in:
maliakal_d 2021-11-10 11:47:26 +01:00
parent 15aa42d328
commit 233d374a4d
12 changed files with 42 additions and 15 deletions

View File

@ -21,6 +21,8 @@ This document describes the differences between vx.x.x and v6.0.0.
==========================
- kernelversion
- updatekernel
- updatedetectorserver
- update (without pcname)
2. Resolved Issues

View File

@ -4,12 +4,15 @@
#include "common.h"
#include "clogger.h"
#include "sls/sls_detector_defs.h"
#include "slsDetectorServer_defs.h"
#include <libgen.h> // dirname
#include <string.h>
#include <sys/utsname.h> // uname
#include <unistd.h> // readlink
extern int executeCommand(char *command, char *result, enum TLogLevel level);
int ConvertToDifferentRange(int inputMin, int inputMax, int outputMin,
int outputMax, int inputValue, int *outputValue) {
LOG(logDEBUG1, (" Input Value: %d (Input:(%d - %d), Output:(%d - %d))\n",
@ -101,7 +104,8 @@ int getTimeFromString(char *buf, time_t *result) {
}
int getKernelVersion(char *retvals) {
struct utsname buf = {0};
struct utsname buf;
memset(&buf, 0, sizeof(buf));
if (uname(&buf) == -1) {
strcpy(retvals, "Failed to get utsname structure from uname\n");
LOG(logERROR, (retvals));
@ -461,7 +465,7 @@ int setupDetectorServer(char *mess, char *sname) {
LOG(logINFO, ("\tinittab: DetectoServer line deleted\n"));
// add new link name to /etc/inittab
format = "echo 'ttyS0::respawn:/./%s' >> /etc/inittab";
char* format = "echo 'ttyS0::respawn:/./%s' >> /etc/inittab";
if (snprintf(cmd, MAX_STR_LENGTH, format, LINKED_SERVER_NAME) >=
MAX_STR_LENGTH) {
strcpy(mess, "Could not copy detector server. Command "
@ -488,4 +492,5 @@ int setupDetectorServer(char *mess, char *sname) {
return FAIL;
}
LOG(logINFO, ("\tsync\n"));
return OK;
}

View File

@ -1733,7 +1733,8 @@ class Detector {
/** [Jungfrau][CTB][Moench] Advanced user Function! */
void resetFPGA(Positions pos = {});
/** [Jungfrau][Eiger][Gotthard][CTB][Moench][Mythen3][Gotthard2]
/** [[deprecated ("Replaced by updateDetectorServer, which does not require tftp")]]
* [Jungfrau][Eiger][Gotthard][CTB][Moench][Mythen3][Gotthard2]
* Advanced user Function! \n
* Copy detector server fname from tftp folder of hostname to detector. Also
* creates a symbolic link to a shorter name (without vx.x.x). Then the
@ -1763,7 +1764,7 @@ class Detector {
* Function! */
void rebootController(Positions pos = {});
/**
/** [[deprecated ("Replaced by overloaded updateDetectorServer, which does not require tftp and has one less argument")]]
* Advanced user Function!\n [Jungfrau][Gotthard][CTB][Moench] Updates the
* firmware, detector server, make a soft link and then reboots detector
* controller. \n [Mythen3][Gotthard2] Will require a script to start up the
@ -1775,6 +1776,16 @@ class Detector {
const std::string &hostname,
const std::string &fname, Positions pos = {});
/**
* Advanced user Function!\n [Jungfrau][Gotthard][CTB][Moench] Updates the
* firmware, detector server, make a soft link and then reboots detector
* controller. \n [Mythen3][Gotthard2] Will require a script to start up the
* shorter named server link at start up \n sname is full path name of detector
* server \n fname is programming file name with full path to it
*/
void updateFirmwareAndServer(const std::string &sname,
const std::string &fname, Positions pos = {});
/** Advanced user Function! \n
* Goes to stop server. Hence, can be called while calling blocking
* acquire(). \n [Eiger] Address is +0x100 for only left, +0x200 for only

View File

@ -2853,6 +2853,7 @@ std::string CmdProxy::CopyDetectorServer(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
LOG(logWARNING) << "Deprecated! Replaced by updatedetectorserver that requires no tftp.\n";
os << "[server_name (in tftp folder)] "
"[pc_host_name]\n\t[Jungfrau][Eiger][Ctb][Moench][Mythen3]["
"Gotthard2] Copies detector server via TFTP from pc. Ensure that "

View File

@ -2156,19 +2156,17 @@ void Detector::copyDetectorServer(const std::string &fname,
void Detector::updateDetectorServer(const std::string &fname, Positions pos) {
LOG(logINFO) << "Updating Detector Server...";
const std::string &serverName std::vector<char> buffer =
std::vector<char> buffer =
readBinaryFile(fname, "Update Detector Server");
// get file name
// get only the file name
std::string filename(fname);
std::size_t pos = fname.rfind('/');
if (pos != std::string::npos) {
filename = filePath.substr(pos + 1, filePath.size() - 1);
std::size_t slashPos = fname.rfind('/');
if (slashPos != std::string::npos) {
filename = fname.substr(slashPos + 1, fname.size() - 1);
}
LOG(logINFOBLUE) << "filename:" << filename;
exit(-1);
std::filesystem::path(fname).filename();
pimpl->Parallel(&Module::updateDetectorServer, pos, buffer);
pimpl->Parallel(&Module::updateDetectorServer, pos, buffer, filename);
if (getDetectorType().squash() != defs::EIGER) {
rebootController(pos);
}
@ -2192,6 +2190,16 @@ void Detector::updateFirmwareAndServer(const std::string &sname,
LOG(logINFO) << "Updating Firmware and Detector Server...";
pimpl->Parallel(&Module::copyDetectorServer, pos, sname, hostname);
programFPGA(fname, pos);
rebootController(pos);
}
void Detector::updateFirmwareAndServer(const std::string &sname,
const std::string &fname,
Positions pos) {
LOG(logINFO) << "Updating Firmware and Detector Server (no tftp)...";
updateDetectorServer(sname, pos);
programFPGA(fname, pos);
rebootController(pos);
}
Result<uint32_t> Detector::readRegister(uint32_t addr, Positions pos) const {

View File

@ -6,10 +6,10 @@
#define APILIB 0x211027
#define APIRECEIVER 0x211020
#define APIGUI 0x211021
#define APIEIGER 0x211109
#define APICTB 0x211109
#define APIGOTTHARD 0x211109
#define APIGOTTHARD2 0x211109
#define APIJUNGFRAU 0x211109
#define APIMYTHEN3 0x211109
#define APIMOENCH 0x211109
#define APIEIGER 0x211109
#define APIJUNGFRAU 0x211110