diff --git a/RELEASE.txt b/RELEASE.txt index f69f3eb86..7ca896314 100755 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -59,6 +59,8 @@ This document describes the differences between v7.0.0 and v6.x.x - gotthard 25 um image reconstructed in gui and virtual hdf5 (firmware updated for slave to reverse channels) - 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 +- updatedetectorserver - removes old server current binary pointing to for blackfin +- removing copydetectorserver using tftp - registerCallBackRawDataReady and registerCallBackRawDataModifyReady now gives a sls_receiver_header* instead of a char*, and uint32_t to size_t - registerCallBackStartAcquisition gave incorrect imagesize (+120 bytes). corrected. - registerCallBackStartAcquisition parameter is a const string reference diff --git a/docs/src/pygettingstarted.rst b/docs/src/pygettingstarted.rst index f84f25a53..424416a78 100644 --- a/docs/src/pygettingstarted.rst +++ b/docs/src/pygettingstarted.rst @@ -136,7 +136,7 @@ can use dir() '__str__', '__subclasshook__', '_adc_register', '_frozen', '_register', 'acquire', 'adcclk', 'adcphase', 'adcpipeline', 'adcreg', 'asamples', 'auto_comp_disable', 'clearAcquiringFlag', - 'clearBit', 'clearROI', 'client_version', 'config', 'copyDetectorServer', + 'clearBit', 'clearROI', 'client_version', 'config', 'counters', 'daclist', 'dacvalues', 'dbitclk', 'dbitphase' ... Since the list for Detector is rather long it's an good idea to filter it. diff --git a/docs/src/serverupgrade.rst b/docs/src/serverupgrade.rst index 889673528..d7e7a3510 100644 --- a/docs/src/serverupgrade.rst +++ b/docs/src/serverupgrade.rst @@ -5,17 +5,42 @@ Detector Server Upgrade **Location:** slsDetectorPackage/serverBin/ folder for every release. +.. note :: + + For Mythen3, Gotthard2 and Eiger, you need to add scripts to automatically start detector server upon power on. See :ref:`Automatic start` for more details. + + .. note :: + + Eiger requires a manual reboot. Or killall the servers and restart the new linked one. If you are in the process of updating firmware, then don't reboot yet. + + +From 6.1.1 and above (no tftp required) +--------------------------------------- + +#. Program from console + + .. code-block:: bash + + # the following command copies new server, creates a soft link to xxxDetectorServerxxx + # [Jungfrau][CTB][Moench] also deletes the old server binary and edits initttab to respawn server on reboot + # Then, the detector controller will reboot (except Eiger) + sls_detector_put updatedetectorserver /complete-path-to-binary/xxxDetectorServerxxx + +#. Copy the detector server specific config files or any others required to the detector: + + .. code-block:: bash + + sls_detector_put execcommand "tftp pcxxx -r configxxx -g" + +5.0.0 - 6.1.1 +-------------- #. Install tftp and copy detector server binary to tftp folder #. Program from console - .. note :: - - These instructions are for upgrades from v5.0.0. For earlier versions, contact us. - .. code-block:: bash - # copies new server from pc tftp folder, creates a soft link to xxxDetectorServerxxx + # the following command copies new server from pc tftp folder, creates a soft link to xxxDetectorServerxxx # [Jungfrau][CTB][Moench] also edits initttab to respawn server on reboot # Then, the detector controller will reboot (except Eiger) sls_detector_put copydetectorserver xxxDetectorServerxxx pcxxx @@ -27,18 +52,15 @@ Detector Server Upgrade sls_detector_put execcommand "tftp pcxxx -r configxxx -g" -.. note :: - - For Mythen3, Gotthard2 and Eiger, you need to add scripts to automatically start detector server upon power on. See :ref:`Automatic start` for more details. - - .. note :: - - Eiger requires a manual reboot. Or killall the servers and restart the new linked one. If you are in the process of updating firmware, then don't reboot yet. - - -Errors ------- +Troubleshooting with tftp +^^^^^^^^^^^^^^^^^^^^^^^^^ #. tftp write error: There is no space left. Please delete some old binaries and try again. -#. text file busy: You are trying to copy the same server. \ No newline at end of file +#. text file busy: You are trying to copy the same server. + + +Older than 5.0.0 +----------------- + +Please contact us. \ No newline at end of file diff --git a/python/src/detector.cpp b/python/src/detector.cpp index 2323a0e1d..1806b7753 100644 --- a/python/src/detector.cpp +++ b/python/src/detector.cpp @@ -1551,11 +1551,6 @@ void init_det(py::module &m) { .def("resetFPGA", (void (Detector::*)(sls::Positions)) & Detector::resetFPGA, 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", (void (Detector::*)(const std::string &, sls::Positions)) & Detector::updateDetectorServer, diff --git a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer index b85880659..c788c3349 100755 Binary files a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer and b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer differ diff --git a/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer b/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer index de82c02ef..78c9b4508 100755 Binary files a/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer and b/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer differ diff --git a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer index ad2379ae3..b0851e4a3 100755 Binary files a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer and b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer differ diff --git a/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer b/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer index 43d71d90b..d8451c9f5 100755 Binary files a/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer and b/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer differ diff --git a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer index d4200dfea..59508c2c6 100755 Binary files a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer and b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer differ diff --git a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer index 43cdabacb..6d757fb5b 100755 Binary files a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer and b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer differ diff --git a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer index ea3ba327b..5b1121873 100755 Binary files a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer and b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer differ diff --git a/slsDetectorServers/slsDetectorServer/include/common.h b/slsDetectorServers/slsDetectorServer/include/common.h index 4b86f6dc9..090952d82 100644 --- a/slsDetectorServers/slsDetectorServer/include/common.h +++ b/slsDetectorServers/slsDetectorServer/include/common.h @@ -66,3 +66,5 @@ int moveBinaryFile(char *mess, char *dest, char *src, char *errorPrefix); int createEmptyFile(char *mess, char *fname, char *errorPrefix); int deleteFile(char *mess, char *fname, char *errorPrefix); + +int deleteOldServers(char *mess, char *newServerPath, char *errorPrefix); diff --git a/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h b/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h index 385b45ae7..854358d94 100644 --- a/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h +++ b/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h @@ -132,7 +132,6 @@ int check_version(int); int software_trigger(int); int led(int); int digital_io_delay(int); -int copy_detector_server(int); int reboot_controller(int); int set_adc_enable_mask(int); int get_adc_enable_mask(int); diff --git a/slsDetectorServers/slsDetectorServer/src/common.c b/slsDetectorServers/slsDetectorServer/src/common.c index df090953a..b57cba2ce 100644 --- a/slsDetectorServers/slsDetectorServer/src/common.c +++ b/slsDetectorServers/slsDetectorServer/src/common.c @@ -50,6 +50,10 @@ int ConvertToDifferentRange(int inputMin, int inputMax, int outputMin, } int getAbsPath(char *buf, size_t bufSize, char *fname) { + if (fname[0] == '/') { + strcpy(buf, fname); + return OK; + } // get path of current binary char path[bufSize]; memset(path, 0, bufSize); @@ -60,10 +64,14 @@ int getAbsPath(char *buf, size_t bufSize, char *fname) { } path[len] = '\0'; - // get dir path and attach config file name + // get dir path and attach file name char *dir = dirname(path); memset(buf, 0, bufSize); - sprintf(buf, "%s/%s", dir, fname); + if (!strcmp(dir, "/")) { + sprintf(buf, "/%s", fname); + } else { + sprintf(buf, "%s/%s", dir, fname); + } LOG(logDEBUG1, ("full path for %s: %s\n", fname, buf)); return OK; } @@ -466,7 +474,7 @@ int setupDetectorServer(char *mess, char *sname) { LOG(logERROR, (mess)); return FAIL; } - LOG(logINFO, ("\tSymbolic link created\n")); + LOG(logINFO, ("\tSymbolic link created %s -> %s\n", linkname, sname)); // blackfin boards (respawn) (only kept for backwards compatibility) #ifndef VIRTUAL @@ -485,7 +493,7 @@ int setupDetectorServer(char *mess, char *sname) { // add new link name to /etc/inittab if (snprintf(cmd, MAX_STR_LENGTH, - "echo 'ttyS0::respawn:/./%s' >> /etc/inittab", + "echo 'ttyS0::respawn:%s' >> /etc/inittab", linkname) >= MAX_STR_LENGTH) { strcpy(mess, "Could not copy detector server. Command " "to add new server for spawning is too long\n"); @@ -670,3 +678,26 @@ int deleteFile(char *mess, char *fname, char *errorPrefix) { } return OK; } + +int deleteOldServers(char *mess, char *newServerPath, char *errorPrefix) { + LOG(logINFO, ("\tChecking if current binary is to be deleted ...\n")) + // get path of current binary (get file name if link) + char currentBinary[MAX_STR_LENGTH]; + memset(currentBinary, 0, MAX_STR_LENGTH); + ssize_t len = readlink("/proc/self/exe", currentBinary, MAX_STR_LENGTH - 1); + if (len < 0) { + LOG(logWARNING, ("(%s): Could not delete old servers. Could not " + "readlink current binary\n", + errorPrefix)); + return FAIL; + } + currentBinary[len] = '\0'; + LOG(logDEBUG1, ("Current binary:%s\n", currentBinary)); + + // delete file + if (deleteFile(mess, currentBinary, errorPrefix) == FAIL) { + LOG(logWARNING, ("(%s). Could not delete old servers\n", errorPrefix)); + return FAIL; + } + return OK; +} diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index fc32272ea..6b78439b3 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -93,7 +93,6 @@ int updateModeAllowedFunction(int file_des) { F_PROGRAM_FPGA, F_RESET_FPGA, F_CHECK_VERSION, - F_COPY_DET_SERVER, F_REBOOT_CONTROLLER, F_GET_KERNEL_VERSION, F_UPDATE_KERNEL, @@ -322,7 +321,6 @@ void function_table() { flist[F_SOFTWARE_TRIGGER] = &software_trigger; flist[F_LED] = &led; flist[F_DIGITAL_IO_DELAY] = &digital_io_delay; - flist[F_COPY_DET_SERVER] = ©_detector_server; flist[F_REBOOT_CONTROLLER] = &reboot_controller; flist[F_SET_ADC_ENABLE_MASK] = &set_adc_enable_mask; flist[F_GET_ADC_ENABLE_MASK] = &get_adc_enable_mask; @@ -4143,65 +4141,15 @@ int digital_io_delay(int file_des) { 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 (ret == OK) { - ret = setupDetectorServer(mess, sname); - } - } -#endif - return Server_SendResult(file_des, OTHER, retvals, sizeof(retvals)); -} - int reboot_controller(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); -#if defined(MYTHEN3D) || defined(GOTTHARD2D) + +#ifdef EIGERD + functionNotImplemented(); +#elif VIRTUAL + ret = GOODBYE; +#elif defined(MYTHEN3D) || defined(GOTTHARD2D) if (getHardwareVersionNumber() == 0) { ret = FAIL; strcpy(mess, "Old board version, reboot by yourself please!\n"); @@ -4209,20 +4157,11 @@ int reboot_controller(int file_des) { Server_SendResult(file_des, INT32, NULL, 0); return GOODBYE; } -#ifdef VIRTUAL - ret = GOODBYE; + ret = REBOOT; #else ret = REBOOT; #endif -#elif EIGERD - functionNotImplemented(); -#else -#ifdef VIRTUAL - ret = GOODBYE; -#else - ret = REBOOT; -#endif -#endif + Server_SendResult(file_des, INT32, NULL, 0); return ret; } @@ -9449,10 +9388,18 @@ int receive_program(int file_des, enum PROGRAM_INDEX index) { if (receiveData(file_des, &forceDeleteNormalFile, sizeof(forceDeleteNormalFile), INT32) < 0) return printSocketReadError(); - LOG(logINFO, - ("\tForce Delete Normal File flag? %s\n", (forceDeleteNormalFile ? "Y" : "N"))); + LOG(logINFO, ("\tForce Delete Normal File flag? %s\n", + (forceDeleteNormalFile ? "Y" : "N"))); #endif + // ensure the name is not the same as the linked name + if (!strcmp(serverName, LINKED_SERVER_NAME)) { + ret = FAIL; + strcpy(mess, "Server name is the same as the symbolic link. Please " + "use a different server name\n"); + LOG(logERROR, (mess)); + } + // in same folder as current process (will also work for virtual then // with write permissions) { @@ -9477,7 +9424,8 @@ int receive_program(int file_des, enum PROGRAM_INDEX index) { checksum, serverName); #else receive_program_via_blackfin(file_des, index, functionType, - filesize, checksum, serverName, forceDeleteNormalFile); + filesize, checksum, serverName, + forceDeleteNormalFile); #endif } @@ -9493,7 +9441,8 @@ int receive_program(int file_des, enum PROGRAM_INDEX index) { void receive_program_via_blackfin(int file_des, enum PROGRAM_INDEX index, char *functionType, uint64_t filesize, - char *checksum, char *serverName, int forceDeleteNormalFile) { + char *checksum, char *serverName, + int forceDeleteNormalFile) { #if !defined(JUNGFRAUD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && \ !defined(GOTTHARDD) @@ -9595,6 +9544,8 @@ void receive_program_via_blackfin(int file_des, enum PROGRAM_INDEX index, totalsize, forceDeleteNormalFile); break; case PROGRAM_SERVER: + // a fail here is not a show stopper (just for memory) + deleteOldServers(mess, serverName, "update detector server"); ret = moveBinaryFile(mess, serverName, TEMP_PROG_FILE_NAME, "update detector server"); if (ret == OK) { diff --git a/slsDetectorSoftware/include/sls/Detector.h b/slsDetectorSoftware/include/sls/Detector.h index 68ccbd2a9..e5f49cc42 100644 --- a/slsDetectorSoftware/include/sls/Detector.h +++ b/slsDetectorSoftware/include/sls/Detector.h @@ -1766,23 +1766,11 @@ class Detector { /** [Jungfrau][CTB][Moench] Advanced user Function! */ 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 * server via TCP (without tftp).\nMakes a symbolic link with a shorter * name (without vx.x.x).\nThen, detector controller reboots (except - * Eiger).\n[Jungfrau][Ctb][Moench]Also changes respawn server to the - * link, which is effective after a reboot. + * Eiger).\n[Jungfrau][Ctb][Moench] Also deletes old server binary and + * changes respawn server to the link, which is effective after a reboot. */ void updateDetectorServer(const std::string &fname, Positions pos = {}); @@ -1797,19 +1785,6 @@ 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 shorter named - * server link at start up \n sname is name of detector server binary found - * on tftp folder of host pc \n hostname is name of pc to tftp from \n fname - * is programming file name with full path to it - */ - void updateFirmwareAndServer(const std::string &sname, - 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 diff --git a/slsDetectorSoftware/src/CmdProxy.cpp b/slsDetectorSoftware/src/CmdProxy.cpp index ddd97eb41..153df3ef1 100644 --- a/slsDetectorSoftware/src/CmdProxy.cpp +++ b/slsDetectorSoftware/src/CmdProxy.cpp @@ -2916,35 +2916,6 @@ std::string CmdProxy::ProgramFpga(int action) { 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{det_id}); - os << "successful\n"; - } else { - throw sls::RuntimeError("Unknown action"); - } - return os.str(); -} - std::string CmdProxy::UpdateDetectorServer(int action) { std::ostringstream os; os << cmd << ' '; @@ -3001,23 +2972,21 @@ std::string CmdProxy::UpdateFirmwareAndDetectorServer(int action) { std::ostringstream os; os << cmd << ' '; if (action == defs::HELP_ACTION) { - os << "\n\tUsing tftp: Deprecated!! [server_name" - " (in tftp folder)] [pc_host_name] [fname.pof (incl full path)]" - "\n\tWithout tftp: Recommended [server_name (incl fullpath)] " + os << "\n\tWithout tftp: [server_name (incl fullpath)] " "[fname.pof (incl full path)] " "This does not use tftp." "\n\t\t[Jungfrau][Gotthard][CTB][Moench] Updates the " - "firmware, detector server, creates the symbolic link and then " + "firmware, detector server, deletes old server, creates the symbolic link and then " "reboots detector controller. \n\t\t[Mythen3][Gotthard2] will " "require a script to start up the shorter named server link at " - "start up. \n\t\tsname is full path name of detector server " + "start up. \n\t\tserver_name is full path name of detector server " "binary" "\n\t\tfname is full path of programming file" << '\n'; } else if (action == defs::GET_ACTION) { throw sls::RuntimeError("Cannot get"); } else if (action == defs::PUT_ACTION) { - if (args.size() != 3 && args.size() != 2) { + if (args.size() != 2) { WrongNumberOfParameters(2); } @@ -3026,17 +2995,8 @@ std::string CmdProxy::UpdateFirmwareAndDetectorServer(int action) { args[fpos].find(".rbf") == std::string::npos) { throw sls::RuntimeError("Programming file must be a pof/rbf file."); } - - if (args.size() == 3) { - LOG(logWARNING) - << "Deprecated! Recommend to use same command without tftp (no " - "pc name) and using full path to the server binary"; - det->updateFirmwareAndServer(args[0], args[1], args[2], + det->updateFirmwareAndServer(args[0], args[1], std::vector{det_id}); - } else { - det->updateFirmwareAndServer(args[0], args[1], - std::vector{det_id}); - } os << "successful\n"; } else { throw sls::RuntimeError("Unknown action"); diff --git a/slsDetectorSoftware/src/CmdProxy.h b/slsDetectorSoftware/src/CmdProxy.h index 293bda371..839f1eea4 100644 --- a/slsDetectorSoftware/src/CmdProxy.h +++ b/slsDetectorSoftware/src/CmdProxy.h @@ -743,7 +743,11 @@ class CmdProxy { /* Pattern */ /* Moench */ + /* Advanced */ + {"copydetectorserver", "updatedetectorserver"}, + + /* Insignificant */ {"nframes", "framecounter"}, {"now", "runtime"}, @@ -1062,7 +1066,6 @@ class CmdProxy { /* Advanced */ {"programfpga", &CmdProxy::ProgramFpga}, {"resetfpga", &CmdProxy::resetfpga}, - {"copydetectorserver", &CmdProxy::CopyDetectorServer}, {"updatedetectorserver", &CmdProxy::UpdateDetectorServer}, {"updatekernel", &CmdProxy::UpdateKernel}, {"rebootcontroller", &CmdProxy::rebootcontroller}, @@ -1189,7 +1192,6 @@ class CmdProxy { std::string JsonParameter(int action); /* Advanced */ std::string ProgramFpga(int action); - std::string CopyDetectorServer(int action); std::string UpdateDetectorServer(int action); std::string UpdateKernel(int action); std::string UpdateFirmwareAndDetectorServer(int action); diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index 31720a1ec..912cdfd3b 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -2242,15 +2242,6 @@ void Detector::resetFPGA(Positions 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) { LOG(logINFO) << "Updating Detector Server (no tftp)..."; std::vector buffer = readBinaryFile(fname, "Update Detector Server"); @@ -2272,16 +2263,6 @@ void Detector::rebootController(Positions pos) { pimpl->Parallel(&Module::rebootController, pos); } -void Detector::updateFirmwareAndServer(const std::string &sname, - const std::string &hostname, - const std::string &fname, - Positions pos) { - LOG(logINFO) << "Updating Firmware and Detector Server (with tftp)..."; - LOG(logINFO) << "Updating Detector Server (via tftp)..."; - pimpl->Parallel(&Module::copyDetectorServer, pos, sname, hostname); - programFPGA(fname, false, pos); -} - void Detector::updateFirmwareAndServer(const std::string &sname, const std::string &fname, Positions pos) { diff --git a/slsDetectorSoftware/src/DetectorImpl.cpp b/slsDetectorSoftware/src/DetectorImpl.cpp index de4b45609..dc3fefac6 100644 --- a/slsDetectorSoftware/src/DetectorImpl.cpp +++ b/slsDetectorSoftware/src/DetectorImpl.cpp @@ -1288,8 +1288,13 @@ std::vector DetectorImpl::readProgrammingFile(const std::string &fname) { throw RuntimeError("Programming file must be an rbf file."); } break; - default: + case EIGER: + case GOTTHARD: throw RuntimeError("programfpga not implemented for this detector"); + default: + throw RuntimeError( + "Unknown detector type. Did the 'hostname' command execute " + "successfully? Or use update mode in the detector server side."); } LOG(logINFO) << "This can take awhile. Please be patient."; diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index 7178e75f1..18b6ca3fa 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -2611,28 +2611,6 @@ void Module::programFPGA(std::vector buffer, 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() == 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 buffer, const std::string &serverName) { switch (shm()->detType) { diff --git a/slsDetectorSoftware/src/Module.h b/slsDetectorSoftware/src/Module.h index fe5c5f5b3..cef1349cf 100644 --- a/slsDetectorSoftware/src/Module.h +++ b/slsDetectorSoftware/src/Module.h @@ -548,8 +548,6 @@ class Module : public virtual slsDetectorDefs { void programFPGA(std::vector buffer, const bool forceDeleteNormalFile); void resetFPGA(); - void copyDetectorServer(const std::string &fname, - const std::string &hostname); void updateDetectorServer(std::vector buffer, const std::string &serverName); void updateKernel(std::vector buffer); diff --git a/slsDetectorSoftware/tests/test-CmdProxy.cpp b/slsDetectorSoftware/tests/test-CmdProxy.cpp index f3e631fa4..5ed8e6e86 100644 --- a/slsDetectorSoftware/tests/test-CmdProxy.cpp +++ b/slsDetectorSoftware/tests/test-CmdProxy.cpp @@ -2787,25 +2787,6 @@ TEST_CASE("resetfpga", "[.cmd]") { } } -TEST_CASE("copydetectorserver", "[.cmd]") { - Detector det; - CmdProxy proxy(&det); - auto det_type = det.getDetectorType().squash(); - if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD || - det_type == defs::MOENCH || det_type == defs::MYTHEN3 || - det_type == defs::GOTTHARD2) { - // TODO: send real server? - // std::ostringstream oss; - // proxy.Call("copydetectorserver",{"jungfrauDetectorServerv4.0.1.0", - // "pc13784"}, -1, PUT, oss); - // REQUIRE(oss.str() == "copydetectorserver successful\n"); - REQUIRE_THROWS(proxy.Call("copydetectorserver", {}, -1, GET)); - } else { - REQUIRE_THROWS(proxy.Call("copydetectorserver", {}, -1, GET)); - REQUIRE_THROWS(proxy.Call("copydetectorserver", {}, -1, PUT)); - } -} - TEST_CASE("updatekernel", "[.cmd]") { Detector det; CmdProxy proxy(&det); diff --git a/slsSupportLib/include/sls/sls_detector_funcs.h b/slsSupportLib/include/sls/sls_detector_funcs.h index 13db10087..a6e5569e1 100755 --- a/slsSupportLib/include/sls/sls_detector_funcs.h +++ b/slsSupportLib/include/sls/sls_detector_funcs.h @@ -111,7 +111,6 @@ enum detFuncs { F_SOFTWARE_TRIGGER, F_LED, F_DIGITAL_IO_DELAY, - F_COPY_DET_SERVER, F_REBOOT_CONTROLLER, F_SET_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_LED: return "F_LED"; 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_SET_ADC_ENABLE_MASK: return "F_SET_ADC_ENABLE_MASK"; case F_GET_ADC_ENABLE_MASK: return "F_GET_ADC_ENABLE_MASK"; diff --git a/slsSupportLib/include/sls/versionAPI.h b/slsSupportLib/include/sls/versionAPI.h index c96fd733d..74dedfe5c 100644 --- a/slsSupportLib/include/sls/versionAPI.h +++ b/slsSupportLib/include/sls/versionAPI.h @@ -2,14 +2,13 @@ // Copyright (C) 2021 Contributors to the SLS Detector Package /** API versions */ #define GITBRANCH "developer" -#define APILIB 0x211125 -#define APIRECEIVER 0x211124 -#define APIGUI 0x211124 - -#define APIEIGER 0x220324 -#define APICTB 0x220328 -#define APIGOTTHARD 0x220328 -#define APIGOTTHARD2 0x220328 -#define APIJUNGFRAU 0x220328 -#define APIMOENCH 0x220328 -#define APIMYTHEN3 0x220404 +#define APILIB 0x220405 +#define APIRECEIVER 0x220405 +#define APIGUI 0x220328 +#define APICTB 0x220405 +#define APIGOTTHARD 0x220405 +#define APIGOTTHARD2 0x220405 +#define APIJUNGFRAU 0x220405 +#define APIMYTHEN3 0x220405 +#define APIMOENCH 0x220405 +#define APIEIGER 0x220405