mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-19 18:40:01 +02:00
moduleid made into dec not hex
This commit is contained in:
parent
fb94ddec74
commit
7d927a794e
@ -1 +1 @@
|
||||
0xbeb001
|
||||
001
|
@ -1 +1 @@
|
||||
0xbeb001
|
||||
031
|
@ -1 +1 @@
|
||||
0x1234
|
||||
1234
|
@ -292,7 +292,7 @@ int getModuleId(int *ret, char *mess) {
|
||||
}
|
||||
|
||||
void setModuleId(int modid) {
|
||||
LOG(logINFOBLUE, ("Setting module id in fpga: 0x%x\n", modid))
|
||||
LOG(logINFOBLUE, ("Setting module id in fpga: %d\n", modid))
|
||||
bus_w(MOD_ID_REG, bus_r(MOD_ID_REG) & ~MOD_ID_MSK);
|
||||
bus_w(MOD_ID_REG, bus_r(MOD_ID_REG) | ((modid << MOD_ID_OFST) & MOD_ID_MSK));
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
0x1234
|
||||
0
|
@ -287,7 +287,7 @@ int getModuleId(int *ret, char *mess) {
|
||||
}
|
||||
|
||||
void setModuleId(int modid) {
|
||||
LOG(logINFOBLUE, ("Setting module id in fpga: 0x%x\n", modid))
|
||||
LOG(logINFOBLUE, ("Setting module id in fpga: %d\n", modid))
|
||||
bus_w(MOD_ID_REG, bus_r(MOD_ID_REG) & ~MOD_ID_MSK);
|
||||
bus_w(MOD_ID_REG,
|
||||
bus_r(MOD_ID_REG) | ((modid << MOD_ID_OFST) & MOD_ID_MSK));
|
||||
|
@ -32,7 +32,6 @@ void validate64(int *ret, char *mess, int64_t arg, int64_t retval,
|
||||
char *modename, enum numberMode nummode);
|
||||
|
||||
int getModuleIdInFile(int *ret, char *mess, char *fileName);
|
||||
int setModuleIdInFile(char *mess, int arg, char *fileName);
|
||||
int verifyChecksumFromBuffer(char *mess, char *clientChecksum, char *buffer,
|
||||
ssize_t bytes);
|
||||
int verifyChecksumFromFile(char *mess, char *clientChecksum, char *fname);
|
||||
|
@ -120,7 +120,7 @@ int getModuleIdInFile(int *ret, char *mess, char *fileName) {
|
||||
LOG(logERROR, ("%s\n\n", mess));
|
||||
return -1;
|
||||
}
|
||||
LOG(logDEBUG1, ("Reading det id file %s\n", fileName));
|
||||
LOG(logINFOBLUE, ("Reading det id file %s\n", fileName));
|
||||
|
||||
// read line
|
||||
const size_t len = 256;
|
||||
@ -134,7 +134,7 @@ int getModuleIdInFile(int *ret, char *mess, char *fileName) {
|
||||
}
|
||||
// read id
|
||||
int retval = 0;
|
||||
if (sscanf(line, "%x", &retval) != 1) {
|
||||
if (sscanf(line, "%u", &retval) != 1) {
|
||||
*ret = FAIL;
|
||||
sprintf(mess,
|
||||
"Could not scan det id from on-board server "
|
||||
@ -143,43 +143,10 @@ int getModuleIdInFile(int *ret, char *mess, char *fileName) {
|
||||
LOG(logERROR, ("%s\n\n", mess));
|
||||
return -1;
|
||||
}
|
||||
LOG(logINFOBLUE, ("Module Id: 0x%x (File)\n", retval));
|
||||
LOG(logINFOBLUE, ("Module Id: %d (File)\n", retval));
|
||||
return retval;
|
||||
}
|
||||
|
||||
int setModuleIdInFile(char *mess, int arg, char *fileName) {
|
||||
LOG(logINFOBLUE, ("Setting Module Id: 0x%x (File)\n", arg));
|
||||
|
||||
const int fileNameSize = 128;
|
||||
char fname[fileNameSize];
|
||||
if (getAbsPath(fname, fileNameSize, fileName) == FAIL) {
|
||||
strcpy(mess, "Could not find detid file\n");
|
||||
LOG(logERROR, (mess));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
// open id file
|
||||
FILE *fd = fopen(fname, "r");
|
||||
if (fd == NULL) {
|
||||
strcpy(mess, "Could not find detid file\n");
|
||||
LOG(logERROR, (mess));
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logDEBUG1, ("Writing det id to file %s\n", fileName));
|
||||
|
||||
// write id
|
||||
const size_t len = 256;
|
||||
char line[len];
|
||||
memset(line, 0, len);
|
||||
sprintf(line, "%x", arg);
|
||||
if (EOF == fputs(line, fd)) {
|
||||
strcpy(mess, "Could not write to detid file\n");
|
||||
LOG(logERROR, (mess));
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int verifyChecksumFromBuffer(char *mess, char *clientChecksum, char *buffer,
|
||||
ssize_t bytes) {
|
||||
LOG(logINFO, ("\tVerifying Checksum...\n"));
|
||||
|
@ -1206,7 +1206,7 @@ class CmdProxy {
|
||||
"\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][CTB][Moench]"
|
||||
"Serial number of detector.");
|
||||
|
||||
GET_COMMAND_HEX(
|
||||
GET_COMMAND(
|
||||
moduleid, getModuleId,
|
||||
"\n\t[Gotthard2][Eiger][Mythen3] 16 bit value (ideally unique) "
|
||||
"that is streamed out in the UDP header of the detector. Picked up from a file on the module.");
|
||||
|
Loading…
x
Reference in New Issue
Block a user