removed copydetectorserver

This commit is contained in:
maliakal_d 2022-04-05 14:11:04 +02:00
parent 11bf6a5c58
commit 150d27cf95
19 changed files with 17 additions and 157 deletions

View File

@ -60,6 +60,7 @@ This document describes the differences between v7.0.0 and v6.x.x
- master binary file in json format now - master binary file in json format now
- fixed bug introduced in 6.0.0: hdf5 files created 1 file per frame after the initial file which had maxframesperfile - fixed bug introduced in 6.0.0: hdf5 files created 1 file per frame after the initial file which had maxframesperfile
- updatedetectorserver - removes old server current binary pointing to for blackfin - updatedetectorserver - removes old server current binary pointing to for blackfin
- removing copydetectorserver using tftp
2. Resolved Issues 2. Resolved Issues

View File

@ -1551,11 +1551,6 @@ void init_det(py::module &m) {
.def("resetFPGA", .def("resetFPGA",
(void (Detector::*)(sls::Positions)) & Detector::resetFPGA, (void (Detector::*)(sls::Positions)) & Detector::resetFPGA,
py::arg() = Positions{}) py::arg() = Positions{})
.def("copyDetectorServer",
(void (Detector::*)(const std::string &, const std::string &,
sls::Positions)) &
Detector::copyDetectorServer,
py::arg(), py::arg(), py::arg() = Positions{})
.def("updateDetectorServer", .def("updateDetectorServer",
(void (Detector::*)(const std::string &, sls::Positions)) & (void (Detector::*)(const std::string &, sls::Positions)) &
Detector::updateDetectorServer, Detector::updateDetectorServer,

View File

@ -132,7 +132,6 @@ int check_version(int);
int software_trigger(int); int software_trigger(int);
int led(int); int led(int);
int digital_io_delay(int); int digital_io_delay(int);
int copy_detector_server(int);
int reboot_controller(int); int reboot_controller(int);
int set_adc_enable_mask(int); int set_adc_enable_mask(int);
int get_adc_enable_mask(int); int get_adc_enable_mask(int);

View File

@ -93,7 +93,6 @@ int updateModeAllowedFunction(int file_des) {
F_PROGRAM_FPGA, F_PROGRAM_FPGA,
F_RESET_FPGA, F_RESET_FPGA,
F_CHECK_VERSION, F_CHECK_VERSION,
F_COPY_DET_SERVER,
F_REBOOT_CONTROLLER, F_REBOOT_CONTROLLER,
F_GET_KERNEL_VERSION, F_GET_KERNEL_VERSION,
F_UPDATE_KERNEL, F_UPDATE_KERNEL,
@ -322,7 +321,6 @@ void function_table() {
flist[F_SOFTWARE_TRIGGER] = &software_trigger; flist[F_SOFTWARE_TRIGGER] = &software_trigger;
flist[F_LED] = &led; flist[F_LED] = &led;
flist[F_DIGITAL_IO_DELAY] = &digital_io_delay; flist[F_DIGITAL_IO_DELAY] = &digital_io_delay;
flist[F_COPY_DET_SERVER] = &copy_detector_server;
flist[F_REBOOT_CONTROLLER] = &reboot_controller; flist[F_REBOOT_CONTROLLER] = &reboot_controller;
flist[F_SET_ADC_ENABLE_MASK] = &set_adc_enable_mask; flist[F_SET_ADC_ENABLE_MASK] = &set_adc_enable_mask;
flist[F_GET_ADC_ENABLE_MASK] = &get_adc_enable_mask; flist[F_GET_ADC_ENABLE_MASK] = &get_adc_enable_mask;
@ -4143,65 +4141,6 @@ int digital_io_delay(int file_des) {
return Server_SendResult(file_des, INT32, NULL, 0); return Server_SendResult(file_des, INT32, NULL, 0);
} }
int copy_detector_server(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
char args[2][MAX_STR_LENGTH];
char retvals[MAX_STR_LENGTH] = {0};
memset(args, 0, sizeof(args));
memset(retvals, 0, sizeof(retvals));
if (receiveData(file_des, args, sizeof(args), OTHER) < 0)
return printSocketReadError();
#ifdef VIRTUAL
functionNotImplemented();
#else
// only set
if (Server_VerifyLock() == OK) {
char *sname = args[0];
char *hostname = args[1];
LOG(logINFOBLUE, ("Copying server %s from host %s\n", sname, hostname));
char cmd[MAX_STR_LENGTH] = {0};
#ifdef BLACKFIN_DEFINED
// check update is allowed (Non Amd OR AMD + current kernel)
ret = allowUpdate(mess, "copy detector server");
#endif
// tftp server
if (ret == OK) {
if (snprintf(cmd, MAX_STR_LENGTH, "tftp %s -r %s -g", hostname,
sname) >= MAX_STR_LENGTH) {
ret = FAIL;
strcpy(mess, "Could not copy detector server. Command to copy "
"server too long\n");
LOG(logERROR, (mess));
} else if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
ret = FAIL;
snprintf(mess, MAX_STR_LENGTH,
"Could not copy detector server (tftp). %s\n",
retvals);
// LOG(logERROR, (mess)); already printed in executecommand
} else {
LOG(logINFO, ("\tServer copied\n"));
}
}
#if defined(JUNGFRAUD) || defined(GOTTHARDD) || defined(CHIPTESTBOARDD) || defined(MOENCHD)
// a fail here is not a show stopper (just for memory)
deleteOldServers(mess, serverName, "update detector server");
#endif
if (ret == OK) {
ret = setupDetectorServer(mess, sname);
}
}
#endif
return Server_SendResult(file_des, OTHER, retvals, sizeof(retvals));
}
int reboot_controller(int file_des) { int reboot_controller(int file_des) {
ret = OK; ret = OK;
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));

View File

@ -1766,23 +1766,11 @@ class Detector {
/** [Jungfrau][CTB][Moench] Advanced user Function! */ /** [Jungfrau][CTB][Moench] Advanced user Function! */
void resetFPGA(Positions pos = {}); void resetFPGA(Positions pos = {});
/** [[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
* detector controller reboots (except eiger) \n
* [Jungfrau][Gotthard][CTB][Moench] Also changes respawn server (to the
* link), which is effective after a reboot.
*/
void copyDetectorServer(const std::string &fname,
const std::string &hostname, Positions pos = {});
/** [Jungfrau][Eiger][Ctb][Moench][Mythen3][Gotthard2] Copies detector /** [Jungfrau][Eiger][Ctb][Moench][Mythen3][Gotthard2] Copies detector
* server via TCP (without tftp).\nMakes a symbolic link with a shorter * server via TCP (without tftp).\nMakes a symbolic link with a shorter
* name (without vx.x.x).\nThen, detector controller reboots (except * name (without vx.x.x).\nThen, detector controller reboots (except
* Eiger).\n[Jungfrau][Ctb][Moench]Also changes respawn server to the * Eiger).\n[Jungfrau][Ctb][Moench] Also deletes old server binary and
* link, which is effective after a reboot. * changes respawn server to the link, which is effective after a reboot.
*/ */
void updateDetectorServer(const std::string &fname, Positions pos = {}); void updateDetectorServer(const std::string &fname, Positions pos = {});

View File

@ -2911,35 +2911,6 @@ std::string CmdProxy::ProgramFpga(int action) {
return os.str(); return os.str();
} }
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 "
"server is in the pc's tftp folder. Makes a symbolic link with a "
"shorter name (without vx.x.x). Then, detector controller "
"reboots (except "
"Eiger).\n\t[Jungfrau][Ctb][Moench]Also changes respawn server "
"to the link, which is effective after a reboot."
<< '\n';
} else if (action == defs::GET_ACTION) {
throw sls::RuntimeError("Cannot get");
} else if (action == defs::PUT_ACTION) {
if (args.size() != 2) {
WrongNumberOfParameters(2);
}
det->copyDetectorServer(args[0], args[1], std::vector<int>{det_id});
os << "successful\n";
} else {
throw sls::RuntimeError("Unknown action");
}
return os.str();
}
std::string CmdProxy::UpdateDetectorServer(int action) { std::string CmdProxy::UpdateDetectorServer(int action) {
std::ostringstream os; std::ostringstream os;
os << cmd << ' '; os << cmd << ' ';

View File

@ -743,7 +743,11 @@ class CmdProxy {
/* Pattern */ /* Pattern */
/* Moench */ /* Moench */
/* Advanced */ /* Advanced */
{"copydetectorserver", "updatedetectorserver"},
/* Insignificant */ /* Insignificant */
{"nframes", "framecounter"}, {"nframes", "framecounter"},
{"now", "runtime"}, {"now", "runtime"},
@ -1062,7 +1066,6 @@ class CmdProxy {
/* Advanced */ /* Advanced */
{"programfpga", &CmdProxy::ProgramFpga}, {"programfpga", &CmdProxy::ProgramFpga},
{"resetfpga", &CmdProxy::resetfpga}, {"resetfpga", &CmdProxy::resetfpga},
{"copydetectorserver", &CmdProxy::CopyDetectorServer},
{"updatedetectorserver", &CmdProxy::UpdateDetectorServer}, {"updatedetectorserver", &CmdProxy::UpdateDetectorServer},
{"updatekernel", &CmdProxy::UpdateKernel}, {"updatekernel", &CmdProxy::UpdateKernel},
{"rebootcontroller", &CmdProxy::rebootcontroller}, {"rebootcontroller", &CmdProxy::rebootcontroller},
@ -1189,7 +1192,6 @@ class CmdProxy {
std::string JsonParameter(int action); std::string JsonParameter(int action);
/* Advanced */ /* Advanced */
std::string ProgramFpga(int action); std::string ProgramFpga(int action);
std::string CopyDetectorServer(int action);
std::string UpdateDetectorServer(int action); std::string UpdateDetectorServer(int action);
std::string UpdateKernel(int action); std::string UpdateKernel(int action);
std::string UpdateFirmwareAndDetectorServer(int action); std::string UpdateFirmwareAndDetectorServer(int action);

View File

@ -2242,15 +2242,6 @@ void Detector::resetFPGA(Positions pos) {
pimpl->Parallel(&Module::resetFPGA, pos); pimpl->Parallel(&Module::resetFPGA, pos);
} }
void Detector::copyDetectorServer(const std::string &fname,
const std::string &hostname, Positions pos) {
LOG(logINFO) << "Updating Detector Server (via tftp)...";
pimpl->Parallel(&Module::copyDetectorServer, pos, fname, hostname);
if (getDetectorType().squash() != defs::EIGER) {
rebootController(pos);
}
}
void Detector::updateDetectorServer(const std::string &fname, Positions pos) { void Detector::updateDetectorServer(const std::string &fname, Positions pos) {
LOG(logINFO) << "Updating Detector Server (no tftp)..."; LOG(logINFO) << "Updating Detector Server (no tftp)...";
std::vector<char> buffer = readBinaryFile(fname, "Update Detector Server"); std::vector<char> buffer = readBinaryFile(fname, "Update Detector Server");

View File

@ -2611,28 +2611,6 @@ void Module::programFPGA(std::vector<char> buffer,
void Module::resetFPGA() { sendToDetector(F_RESET_FPGA); } void Module::resetFPGA() { sendToDetector(F_RESET_FPGA); }
void Module::copyDetectorServer(const std::string &fname,
const std::string &hostname) {
char args[2][MAX_STR_LENGTH]{};
sls::strcpy_safe(args[0], fname.c_str());
sls::strcpy_safe(args[1], hostname.c_str());
LOG(logINFO) << "Module " << moduleIndex << " (" << shm()->hostname
<< "): Sending detector server " << args[0] << " from host "
<< args[1];
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
client.Send(F_COPY_DET_SERVER);
client.Send(args);
if (client.Receive<int>() == FAIL) {
std::cout << '\n';
std::ostringstream os;
os << "Module " << moduleIndex << " (" << shm()->hostname << ")"
<< " returned error: " << client.readErrorMessage();
throw DetectorError(os.str());
}
LOG(logINFO) << "Module " << moduleIndex << " (" << shm()->hostname
<< "): Detector server copied";
}
void Module::updateDetectorServer(std::vector<char> buffer, void Module::updateDetectorServer(std::vector<char> buffer,
const std::string &serverName) { const std::string &serverName) {
switch (shm()->detType) { switch (shm()->detType) {

View File

@ -548,8 +548,6 @@ class Module : public virtual slsDetectorDefs {
void programFPGA(std::vector<char> buffer, void programFPGA(std::vector<char> buffer,
const bool forceDeleteNormalFile); const bool forceDeleteNormalFile);
void resetFPGA(); void resetFPGA();
void copyDetectorServer(const std::string &fname,
const std::string &hostname);
void updateDetectorServer(std::vector<char> buffer, void updateDetectorServer(std::vector<char> buffer,
const std::string &serverName); const std::string &serverName);
void updateKernel(std::vector<char> buffer); void updateKernel(std::vector<char> buffer);

View File

@ -111,7 +111,6 @@ enum detFuncs {
F_SOFTWARE_TRIGGER, F_SOFTWARE_TRIGGER,
F_LED, F_LED,
F_DIGITAL_IO_DELAY, F_DIGITAL_IO_DELAY,
F_COPY_DET_SERVER,
F_REBOOT_CONTROLLER, F_REBOOT_CONTROLLER,
F_SET_ADC_ENABLE_MASK, F_SET_ADC_ENABLE_MASK,
F_GET_ADC_ENABLE_MASK, F_GET_ADC_ENABLE_MASK,
@ -477,7 +476,6 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_SOFTWARE_TRIGGER: return "F_SOFTWARE_TRIGGER"; case F_SOFTWARE_TRIGGER: return "F_SOFTWARE_TRIGGER";
case F_LED: return "F_LED"; case F_LED: return "F_LED";
case F_DIGITAL_IO_DELAY: return "F_DIGITAL_IO_DELAY"; case F_DIGITAL_IO_DELAY: return "F_DIGITAL_IO_DELAY";
case F_COPY_DET_SERVER: return "F_COPY_DET_SERVER";
case F_REBOOT_CONTROLLER: return "F_REBOOT_CONTROLLER"; case F_REBOOT_CONTROLLER: return "F_REBOOT_CONTROLLER";
case F_SET_ADC_ENABLE_MASK: return "F_SET_ADC_ENABLE_MASK"; case F_SET_ADC_ENABLE_MASK: return "F_SET_ADC_ENABLE_MASK";
case F_GET_ADC_ENABLE_MASK: return "F_GET_ADC_ENABLE_MASK"; case F_GET_ADC_ENABLE_MASK: return "F_GET_ADC_ENABLE_MASK";

View File

@ -2,14 +2,14 @@
// Copyright (C) 2021 Contributors to the SLS Detector Package // Copyright (C) 2021 Contributors to the SLS Detector Package
/** API versions */ /** API versions */
#define GITBRANCH "developer" #define GITBRANCH "developer"
#define APILIB 0x211125
#define APIRECEIVER 0x211124
#define APIGUI 0x211124
#define APICTB 0x220404 #define APILIB 0x220405
#define APIGOTTHARD 0x220404 #define APIRECEIVER 0x220405
#define APIGOTTHARD2 0x220404 #define APIGUI 0x220328
#define APIJUNGFRAU 0x220404 #define APICTB 0x220405
#define APIMYTHEN3 0x220404 #define APIGOTTHARD 0x220405
#define APIMOENCH 0x220404 #define APIGOTTHARD2 0x220405
#define APIEIGER 0x220404 #define APIJUNGFRAU 0x220405
#define APIMYTHEN3 0x220405
#define APIMOENCH 0x220405
#define APIEIGER 0x220405