This commit is contained in:
2021-11-10 10:58:29 +01:00
parent 14ee2087dc
commit 15aa42d328
7 changed files with 131 additions and 106 deletions

View File

@ -2155,7 +2155,19 @@ void Detector::copyDetectorServer(const std::string &fname,
void Detector::updateDetectorServer(const std::string &fname, Positions pos) {
LOG(logINFO) << "Updating Detector Server...";
std::vector<char> buffer = readBinaryFile(fname, "Update Detector Server");
const std::string &serverName std::vector<char> buffer =
readBinaryFile(fname, "Update Detector Server");
// get 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);
}
LOG(logINFOBLUE) << "filename:" << filename;
exit(-1);
std::filesystem::path(fname).filename();
pimpl->Parallel(&Module::updateDetectorServer, pos, buffer);
if (getDetectorType().squash() != defs::EIGER) {
rebootController(pos);

View File

@ -2523,18 +2523,19 @@ void Module::copyDetectorServer(const std::string &fname,
<< "): detector server copied";
}
void Module::updateDetectorServer(std::vector<char> buffer) {
void Module::updateDetectorServer(std::vector<char> buffer,
const std::string &serverName) {
switch (shm()->detType) {
case JUNGFRAU:
case CHIPTESTBOARD:
case MOENCH:
sendProgram(true, buffer, F_UPDATE_DETECTOR_SERVER,
"Update Detector Server (no tftp)");
"Update Detector Server (no tftp)", serverName);
break;
case MYTHEN3:
case GOTTHARD2:
sendProgram(false, buffer, F_UPDATE_DETECTOR_SERVER,
"Update Detector Server (no tftp)");
"Update Detector Server (no tftp)", serverName);
break;
default:
throw RuntimeError("Updating Kernel via the package is not implemented "
@ -3464,7 +3465,8 @@ sls_detector_module Module::readSettingsFile(const std::string &fname,
void Module::sendProgram(bool blackfin, std::vector<char> buffer,
const int functionEnum,
const std::string &functionType) {
const std::string &functionType,
const std::string &serverName) {
LOG(logINFO) << "Module " << moduleIndex << " (" << shm()->hostname
<< "): Sending " << functionType;
@ -3477,11 +3479,15 @@ void Module::sendProgram(bool blackfin, std::vector<char> buffer,
// send checksum
std::string checksum = sls::md5_calculate_checksum(buffer.data(), filesize);
LOG(logDEBUG1) << "Checksum:" << checksum;
char cChecksum[MAX_STR_LENGTH];
memset(cChecksum, 0, MAX_STR_LENGTH);
char cChecksum[MAX_STR_LENGTH] = {0};
strcpy(cChecksum, checksum.c_str());
client.Send(cChecksum);
// send server name
char sname[MAX_STR_LENGTH] = {0};
strcpy(sname, serverName.c_str());
client.Send(sname);
// validate memory allocation etc in detector
if (client.Receive<int>() == FAIL) {
std::ostringstream os;

View File

@ -541,7 +541,8 @@ class Module : public virtual slsDetectorDefs {
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);
void updateKernel(std::vector<char> buffer);
void rebootController();
uint32_t readRegister(uint32_t addr) const;
@ -749,7 +750,8 @@ class Module : public virtual slsDetectorDefs {
sls_detector_module readSettingsFile(const std::string &fname,
bool trimbits = true);
void sendProgram(bool blackfin, std::vector<char> buffer,
const int functionEnum, const std::string &functionType);
const int functionEnum, const std::string &functionType,
const std::string &serverName = nullptr);
void simulatingActivityinDetector(const std::string &functionType,
const int timeRequired);