mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 19:30:03 +02:00
server works
This commit is contained in:
parent
15aa42d328
commit
233d374a4d
@ -21,6 +21,8 @@ This document describes the differences between vx.x.x and v6.0.0.
|
|||||||
==========================
|
==========================
|
||||||
- kernelversion
|
- kernelversion
|
||||||
- updatekernel
|
- updatekernel
|
||||||
|
- updatedetectorserver
|
||||||
|
- update (without pcname)
|
||||||
|
|
||||||
|
|
||||||
2. Resolved Issues
|
2. Resolved Issues
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -4,12 +4,15 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "clogger.h"
|
#include "clogger.h"
|
||||||
#include "sls/sls_detector_defs.h"
|
#include "sls/sls_detector_defs.h"
|
||||||
|
#include "slsDetectorServer_defs.h"
|
||||||
|
|
||||||
#include <libgen.h> // dirname
|
#include <libgen.h> // dirname
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/utsname.h> // uname
|
#include <sys/utsname.h> // uname
|
||||||
#include <unistd.h> // readlink
|
#include <unistd.h> // readlink
|
||||||
|
|
||||||
|
extern int executeCommand(char *command, char *result, enum TLogLevel level);
|
||||||
|
|
||||||
int ConvertToDifferentRange(int inputMin, int inputMax, int outputMin,
|
int ConvertToDifferentRange(int inputMin, int inputMax, int outputMin,
|
||||||
int outputMax, int inputValue, int *outputValue) {
|
int outputMax, int inputValue, int *outputValue) {
|
||||||
LOG(logDEBUG1, (" Input Value: %d (Input:(%d - %d), Output:(%d - %d))\n",
|
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) {
|
int getKernelVersion(char *retvals) {
|
||||||
struct utsname buf = {0};
|
struct utsname buf;
|
||||||
|
memset(&buf, 0, sizeof(buf));
|
||||||
if (uname(&buf) == -1) {
|
if (uname(&buf) == -1) {
|
||||||
strcpy(retvals, "Failed to get utsname structure from uname\n");
|
strcpy(retvals, "Failed to get utsname structure from uname\n");
|
||||||
LOG(logERROR, (retvals));
|
LOG(logERROR, (retvals));
|
||||||
@ -461,7 +465,7 @@ int setupDetectorServer(char *mess, char *sname) {
|
|||||||
LOG(logINFO, ("\tinittab: DetectoServer line deleted\n"));
|
LOG(logINFO, ("\tinittab: DetectoServer line deleted\n"));
|
||||||
|
|
||||||
// add new link name to /etc/inittab
|
// 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) >=
|
if (snprintf(cmd, MAX_STR_LENGTH, format, LINKED_SERVER_NAME) >=
|
||||||
MAX_STR_LENGTH) {
|
MAX_STR_LENGTH) {
|
||||||
strcpy(mess, "Could not copy detector server. Command "
|
strcpy(mess, "Could not copy detector server. Command "
|
||||||
@ -488,4 +492,5 @@ int setupDetectorServer(char *mess, char *sname) {
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tsync\n"));
|
LOG(logINFO, ("\tsync\n"));
|
||||||
|
return OK;
|
||||||
}
|
}
|
@ -1733,7 +1733,8 @@ class Detector {
|
|||||||
/** [Jungfrau][CTB][Moench] Advanced user Function! */
|
/** [Jungfrau][CTB][Moench] Advanced user Function! */
|
||||||
void resetFPGA(Positions pos = {});
|
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
|
* Advanced user Function! \n
|
||||||
* Copy detector server fname from tftp folder of hostname to detector. Also
|
* 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
|
* creates a symbolic link to a shorter name (without vx.x.x). Then the
|
||||||
@ -1763,7 +1764,7 @@ class Detector {
|
|||||||
* Function! */
|
* Function! */
|
||||||
void rebootController(Positions pos = {});
|
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
|
* Advanced user Function!\n [Jungfrau][Gotthard][CTB][Moench] Updates the
|
||||||
* firmware, detector server, make a soft link and then reboots detector
|
* firmware, detector server, make a soft link and then reboots detector
|
||||||
* controller. \n [Mythen3][Gotthard2] Will require a script to start up the
|
* 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 &hostname,
|
||||||
const std::string &fname, Positions pos = {});
|
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
|
/** Advanced user Function! \n
|
||||||
* Goes to stop server. Hence, can be called while calling blocking
|
* Goes to stop server. Hence, can be called while calling blocking
|
||||||
* acquire(). \n [Eiger] Address is +0x100 for only left, +0x200 for only
|
* acquire(). \n [Eiger] Address is +0x100 for only left, +0x200 for only
|
||||||
|
@ -2853,6 +2853,7 @@ std::string CmdProxy::CopyDetectorServer(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
|
LOG(logWARNING) << "Deprecated! Replaced by updatedetectorserver that requires no tftp.\n";
|
||||||
os << "[server_name (in tftp folder)] "
|
os << "[server_name (in tftp folder)] "
|
||||||
"[pc_host_name]\n\t[Jungfrau][Eiger][Ctb][Moench][Mythen3]["
|
"[pc_host_name]\n\t[Jungfrau][Eiger][Ctb][Moench][Mythen3]["
|
||||||
"Gotthard2] Copies detector server via TFTP from pc. Ensure that "
|
"Gotthard2] Copies detector server via TFTP from pc. Ensure that "
|
||||||
|
@ -2156,19 +2156,17 @@ void Detector::copyDetectorServer(const std::string &fname,
|
|||||||
void Detector::updateDetectorServer(const std::string &fname, Positions pos) {
|
void Detector::updateDetectorServer(const std::string &fname, Positions pos) {
|
||||||
LOG(logINFO) << "Updating Detector Server...";
|
LOG(logINFO) << "Updating Detector Server...";
|
||||||
|
|
||||||
const std::string &serverName std::vector<char> buffer =
|
std::vector<char> buffer =
|
||||||
readBinaryFile(fname, "Update Detector Server");
|
readBinaryFile(fname, "Update Detector Server");
|
||||||
|
|
||||||
// get file name
|
// get only the file name
|
||||||
std::string filename(fname);
|
std::string filename(fname);
|
||||||
std::size_t pos = fname.rfind('/');
|
std::size_t slashPos = fname.rfind('/');
|
||||||
if (pos != std::string::npos) {
|
if (slashPos != std::string::npos) {
|
||||||
filename = filePath.substr(pos + 1, filePath.size() - 1);
|
filename = fname.substr(slashPos + 1, fname.size() - 1);
|
||||||
}
|
}
|
||||||
LOG(logINFOBLUE) << "filename:" << filename;
|
|
||||||
exit(-1);
|
pimpl->Parallel(&Module::updateDetectorServer, pos, buffer, filename);
|
||||||
std::filesystem::path(fname).filename();
|
|
||||||
pimpl->Parallel(&Module::updateDetectorServer, pos, buffer);
|
|
||||||
if (getDetectorType().squash() != defs::EIGER) {
|
if (getDetectorType().squash() != defs::EIGER) {
|
||||||
rebootController(pos);
|
rebootController(pos);
|
||||||
}
|
}
|
||||||
@ -2192,6 +2190,16 @@ void Detector::updateFirmwareAndServer(const std::string &sname,
|
|||||||
LOG(logINFO) << "Updating Firmware and Detector Server...";
|
LOG(logINFO) << "Updating Firmware and Detector Server...";
|
||||||
pimpl->Parallel(&Module::copyDetectorServer, pos, sname, hostname);
|
pimpl->Parallel(&Module::copyDetectorServer, pos, sname, hostname);
|
||||||
programFPGA(fname, pos);
|
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 {
|
Result<uint32_t> Detector::readRegister(uint32_t addr, Positions pos) const {
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
#define APILIB 0x211027
|
#define APILIB 0x211027
|
||||||
#define APIRECEIVER 0x211020
|
#define APIRECEIVER 0x211020
|
||||||
#define APIGUI 0x211021
|
#define APIGUI 0x211021
|
||||||
|
#define APIEIGER 0x211109
|
||||||
#define APICTB 0x211109
|
#define APICTB 0x211109
|
||||||
#define APIGOTTHARD 0x211109
|
#define APIGOTTHARD 0x211109
|
||||||
#define APIGOTTHARD2 0x211109
|
#define APIGOTTHARD2 0x211109
|
||||||
#define APIJUNGFRAU 0x211109
|
|
||||||
#define APIMYTHEN3 0x211109
|
#define APIMYTHEN3 0x211109
|
||||||
#define APIMOENCH 0x211109
|
#define APIMOENCH 0x211109
|
||||||
#define APIEIGER 0x211109
|
#define APIJUNGFRAU 0x211110
|
||||||
|
Loading…
x
Reference in New Issue
Block a user