mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-20 08:38:00 +02:00
replaced md5 in client
This commit is contained in:
@ -1240,8 +1240,7 @@ int DetectorImpl::kbhit() {
|
||||
return FD_ISSET(STDIN_FILENO, &fds);
|
||||
}
|
||||
|
||||
std::vector<char> DetectorImpl::readProgrammingFile(const std::string &fname,
|
||||
std::string &checksum) {
|
||||
std::vector<char> DetectorImpl::readProgrammingFile(const std::string &fname) {
|
||||
// validate type of file
|
||||
bool isPof = false;
|
||||
switch (multi_shm()->multiDetectorType) {
|
||||
@ -1390,39 +1389,12 @@ std::vector<char> DetectorImpl::readProgrammingFile(const std::string &fname,
|
||||
"Program FPGA: Could not close destination file after converting");
|
||||
}
|
||||
|
||||
// calculate checksum before deleting file
|
||||
checksum = getMd5Checksum(destfname);
|
||||
|
||||
unlink(destfname); // delete temporary file
|
||||
LOG(logDEBUG1) << "Successfully loaded the rawbin file to program memory";
|
||||
LOG(logINFO) << "Read file into memory";
|
||||
return buffer;
|
||||
}
|
||||
|
||||
std::string DetectorImpl::getMd5Checksum(const std::string &fname) {
|
||||
std::string cmd = "md5sum " + fname;
|
||||
FILE *pipe = popen(cmd.c_str(), "r");
|
||||
if (!pipe) {
|
||||
throw RuntimeError("Could not get md5 checksum to program fpga");
|
||||
}
|
||||
char buffer[256];
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
std::string result;
|
||||
try {
|
||||
while (fgets(buffer, sizeof buffer, pipe) != NULL) {
|
||||
result += buffer;
|
||||
}
|
||||
} catch (std::exception &e) {
|
||||
pclose(pipe);
|
||||
throw RuntimeError(
|
||||
std::string("Could not get md5 checsum to program fpga. Threw ") +
|
||||
std::string(e.what()));
|
||||
}
|
||||
pclose(pipe);
|
||||
auto list = sls::split(result, ' ');
|
||||
return list[0];
|
||||
}
|
||||
|
||||
sls::Result<int> DetectorImpl::getNumberofUDPInterfaces(Positions pos) const {
|
||||
return Parallel(&Module::getNumberofUDPInterfaces, pos);
|
||||
}
|
||||
|
Reference in New Issue
Block a user