diff --git a/slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServer b/slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServer index a7fc22c8d..577c54447 100755 Binary files a/slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServer and b/slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServer differ diff --git a/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c b/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c index 9aaaa50f8..f171d8994 100644 --- a/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c @@ -2,6 +2,7 @@ #include +#include //to gethostname #include @@ -33,16 +34,8 @@ int getNModBoard(enum dimension arg){ int64_t getModuleId(enum idMode arg, int imod){ - /* - switch(arg){ - case MODULE_SERIAL_NUMBER: - return getDetectorNumber(); - case MODULE_FIRMWARE_VERSION: - return FIRMWAREREV; - default: - break; - } - */ + +/**/ return -1; } @@ -51,13 +44,13 @@ int64_t getModuleId(enum idMode arg, int imod){ int64_t getDetectorId(enum idMode arg){ int64_t retval = -1; - /* + switch(arg){ case DETECTOR_SERIAL_NUMBER: - retval = getDetectorMAC(); + retval = getDetectorNumber();/** to be implemented with mac? */ break; case DETECTOR_FIRMWARE_VERSION: - return FIRMWAREREV; + return FIRMWAREREV;/** to be implemented */ case DETECTOR_SOFTWARE_VERSION: retval= SVNREV; retval= (retval <<32) | SVNDATE; @@ -65,14 +58,24 @@ int64_t getDetectorId(enum idMode arg){ default: break; } - */ + return retval; } int getDetectorNumber(){ - /* + int res=0; + char hostname[100]; + if (gethostname(hostname, sizeof hostname) == 0) + puts(hostname); + else + perror("gethostname"); + sscanf(hostname,"%x",&res); + return res; + + +/* char output[255]=""; int res=0; FILE* sysFile = popen("hostname", "r"); @@ -80,8 +83,8 @@ int getDetectorNumber(){ pclose(sysFile); sscanf(output,"%x",&res); return res; - */ - return 0; + */ + } @@ -166,20 +169,17 @@ int getADC(enum detDacIndex ind, int imod){ int setModule(sls_detector_module myMod){ - /* + #ifdef VERBOSE printf("Setting module with settings %d\n",myMod.reg); #endif - //int nchip = myMod.nchip; - //int nchan = (myMod.nchan)/nchip; int i; - for(i=0;ireg=thisDetector->currentSettings; - ostfn << thisDetector->settingsDir << ssettings <<"/settings.sn"<< setw(6) << hex << getId(MODULE_SERIAL_NUMBER, im) << setbase(10); - oscfn << thisDetector->calDir << ssettings << "/calibration.sn"<settingsDir << ssettings <<"/settings."<< setw(6) << hex << getId(DETECTOR_SERIAL_NUMBER) << setbase(10); + oscfn << thisDetector->calDir << ssettings << "/calibration."<settingsDir<calDir <myDetectorType, myMod)) { calfname=oscfn.str(); -#ifdef VERBOSE +//#ifdef VERBOSE cout << calfname << endl; -#endif +//#endif readCalibrationFile(calfname,myMod->gain, myMod->offset); setModule(*myMod); } else { @@ -5623,6 +5623,10 @@ int slsDetector::loadSettingsFile(string fname, int imod) { ostfn << ".sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER, im); fn=ostfn.str(); } + if (fname.find(".beb")==string::npos && fname.find(".trim")==string::npos && fname.find(".settings")==string::npos) { + ostfn << "." << setw(6) << hex << getId(DETECTOR_SERIAL_NUMBER, im); + fn=ostfn.str(); + } myMod=readSettingsFile(fn, thisDetector->myDetectorType); if (myMod) { myMod->module=im; @@ -5651,7 +5655,10 @@ int slsDetector::saveSettingsFile(string fname, int imod) { } for (int im=mmin; immyDetectorType == EIGER) + ostfn << fname << "." << setw(6) << hex << getId(DETECTOR_SERIAL_NUMBER); + else + ostfn << fname << ".sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER); if ((myMod=getModule(im))) { ret=writeSettingsFile(ostfn.str(), thisDetector->myDetectorType, *myMod); deleteModule(myMod); @@ -5680,6 +5687,9 @@ int slsDetector::loadCalibrationFile(string fname, int imod) { if (fname.find(".sn")==string::npos && fname.find(".cal")==string::npos) { ostfn << ".sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER, im); } + if (fname.find(".beb")==string::npos && fname.find(".cal")==string::npos) { + ostfn << "." << setw(6) << hex << getId(DETECTOR_SERIAL_NUMBER); + } fn=ostfn.str(); if((myMod=getModule(im))){ if(readCalibrationFile(fn, myMod->gain, myMod->offset)==FAIL) @@ -5706,7 +5716,10 @@ int slsDetector::saveCalibrationFile(string fname, int imod) { } for (int im=mmin; immyDetectorType == EIGER) + ostfn << fname << "." << setw(6) << hex << getId(DETECTOR_SERIAL_NUMBER); + else + ostfn << fname << ".sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER,im); if ((myMod=getModule(im))) { ret=writeCalibrationFile(ostfn.str(), myMod->gain, myMod->offset); deleteModule(myMod);