updated getting detector mac address for gotthard

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@262 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d 2012-09-19 13:58:03 +00:00
parent 32621b1916
commit e0ad54dd46

View File

@ -706,35 +706,20 @@ int setContinousReadOut(int d) {
u_int64_t getDetectorNumber() { u_int64_t getDetectorNumber() {
char output[255],mac[255]="";
FILE *fp=NULL; u_int64_t res=0;
u_int64_t res; FILE* sysFile = popen("ifconfig eth0 | grep HWaddr | cut -d \" \" -f 11", "r");
char line[150]; fgets(output, sizeof(output), sysFile);
int a[6]; pclose(sysFile);
//getting rid of ":"
int n=0, i; char * pch;
//u_int64_t a0,a1,a2,a3,a4,a5,n=0; pch = strtok (output,":");
fp=fopen("/etc/conf.d/mac","r"); while (pch != NULL){
if (fp==NULL) { strcat(mac,pch);
printf("could not ope MAC file\n");; pch = strtok (NULL, ":");
return -1; }
} sscanf(mac,"%llx",&res);
while (fgets(line,150,fp)) { return res;
//MAC="00:40:8C:CD:00:00"
printf(line);
if (strstr(line,"MAC="))
n=sscanf(line,"MAC=\"%x:%x:%x:%x:%x:%x\"",a+5,a+4,a+3,a+2,a+1,a);
}
fclose(fp);
if (n!=6){
printf("could not scan MAC address\n");;
return -1;
}
res=0;
for (i=0; i<n; i++) {
res=(res<<8)+a[n-1-i];
}
return res;
} }
u_int32_t getFirmwareVersion() { u_int32_t getFirmwareVersion() {