made the detector ip and detector mac update client in configuremac

This commit is contained in:
maliakal_d 2018-02-07 15:16:16 +01:00
parent ecf1e9fac1
commit 5198e67dbd
6 changed files with 70 additions and 27 deletions

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repsitory UUID: e6bd874a88493557fc5127d4a1686832299aaf06
Revision: 312
Repsitory UUID: ecf1e9fac1aaa7034e462638bd01965df892726a
Revision: 313
Branch: 3.0.1
Last Changed Author: Dhanya_Thattil
Last Changed Rev: 3346
Last Changed Date: 2018-02-05 12:40:59.000000002 +0100 ./FebRegisterDefs.h
Last Changed Rev: 3348
Last Changed Date: 2018-02-07 11:04:32.000000002 +0100 ./FebRegisterDefs.h

View File

@ -1,6 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "e6bd874a88493557fc5127d4a1686832299aaf06"
#define GITREPUUID "ecf1e9fac1aaa7034e462638bd01965df892726a"
#define GITAUTH "Dhanya_Thattil"
#define GITREV 0x3346
#define GITDATE 0x20180205
#define GITREV 0x3348
#define GITDATE 0x20180207
#define GITBRANCH "3.0.1"

View File

@ -828,23 +828,6 @@ enum externalCommunicationMode setTiming( enum externalCommunicationMode arg){
/* configure mac */
int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t sourceip, uint32_t udpport, uint32_t udpport2, int ival) {
if (sourcemac != getDetectorMAC()){
printf("*************************************************\n");
printf("WARNING: actual detector mac address %llx does not match the one from client %llx\n",getDetectorMAC(),sourcemac);
sourcemac = getDetectorMAC();
printf("WARNING: Matched detectormac to the hardware mac now\n");
printf("*************************************************\n");
}
//only for 1Gbe
if(!send_to_ten_gig){
if (sourceip != getDetectorIP()){
printf("*************************************************\n");
printf("WARNING: actual detector ip address %x does not match the one from client %x\n",getDetectorIP(),sourceip);
sourceip = getDetectorIP();
printf("WARNING: Matched detector ip to the hardware ip now\n");
printf("*************************************************\n");
}
}
char src_mac[50], src_ip[50],dst_mac[50], dst_ip[50];
int src_port = 0xE185;

View File

@ -6701,8 +6701,41 @@ int slsDetector::configureMAC(){
std::cout<< "Detector returned error: " << mess << std::endl;
setErrorMask((getErrorMask())|(COULD_NOT_CONFIGURE_MAC));
}
else
else {
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
if (thisDetector->myDetectorType == EIGER) {
//rewrite detectormac, detector ip
char arg[2][50];
memset(arg,0,sizeof(arg));
uint64_t idetectormac = 0;
uint32_t idetectorip = 0;
controlSocket->ReceiveDataOnly(arg,sizeof(arg));
sscanf(arg[0], "%lx", &idetectormac);
sscanf(arg[1], "%x", &idetectorip);
sprintf(arg[0],"%02x:%02x:%02x:%02x:%02x:%02x",
(unsigned int)((idetectormac>>40)&0xFF),
(unsigned int)((idetectormac>>32)&0xFF),
(unsigned int)((idetectormac>>24)&0xFF),
(unsigned int)((idetectormac>>16)&0xFF),
(unsigned int)((idetectormac>>8)&0xFF),
(unsigned int)((idetectormac>>0)&0xFF));
sprintf(arg[1],"%d.%d.%d.%d",
(idetectorip>>24)&0xff,
(idetectorip>>16)&0xff,
(idetectorip>>8)&0xff,
(idetectorip)&0xff);
if (strcasecmp(arg[0],thisDetector->detectorMAC)) {
memset(thisDetector->detectorMAC, 0, MAX_STR_LENGTH);
strcpy(thisDetector->detectorMAC, arg[0]);
std::cout << "Detector MAC updated to " << thisDetector->detectorMAC << endl;
}
if (strcasecmp(arg[1],thisDetector->detectorIP)) {
memset(thisDetector->detectorIP, 0, MAX_STR_LENGTH);
strcpy(thisDetector->detectorIP, arg[0]);
std::cout << "Detector IP updated to " << thisDetector->detectorIP << endl;
}
}
}
disconnectControl();
if (ret==FORCE_UPDATE)
updateDetector();

View File

@ -3479,6 +3479,26 @@ int configure_mac(int file_des) {
cprintf(RED, "Warning: %s", mess);
}
else {
#ifdef EIGERD
// change mac to hardware mac, (for 1 gbe) change ip to hardware ip
if (idetectormacadd != getDetectorMAC()){
printf("*************************************************\n");
printf("WARNING: actual detector mac address %llx does not match the one from client %llx\n",getDetectorMAC(),idetectormacadd);
idetectormacadd = getDetectorMAC();
printf("WARNING: Matched detectormac to the hardware mac now\n");
printf("*************************************************\n");
}
//only for 1Gbe
if(!enableTenGigabitEthernet(-1)){
if (detipad != getDetectorIP()){
printf("*************************************************\n");
printf("WARNING: actual detector ip address %x does not match the one from client %x\n",getDetectorIP(),detipad);
detipad = getDetectorIP();
printf("WARNING: Matched detector ip to the hardware ip now\n");
printf("*************************************************\n");
}
}
#endif
retval=configureMAC(ipad,imacadd,idetectormacadd,detipad,udpport,udpport2,0); //digitalTestBit);
if(retval==-1) {
ret = FAIL;
@ -3505,9 +3525,16 @@ int configure_mac(int file_des) {
// send return argument
if (ret==FAIL) {
n += sendData(file_des,mess,sizeof(mess),OTHER);
} else
} else {
n += sendData(file_des,&retval,sizeof(retval),INT32);
#ifdef EIGERD
char arg[2][50];
memset(arg,0,sizeof(arg));
sprintf(arg[0],"%llx",idetectormacadd);
sprintf(arg[1],"%x",detipad);
n += sendData(file_des,arg,sizeof(arg),OTHER);
#endif
}
// return ok / fail
return ret;
}