Improved error handling in the EL737 scalerRecord driver
This commit is contained in:
@ -223,6 +223,7 @@ static long el737_init_record(scalerRecord *psr, CALLBACK *pcallback)
|
|||||||
psr->pact = 1;
|
psr->pact = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
pasynManager->autoConnect(dummyUser, 1);
|
||||||
status = pasynOctetSyncIO->connect(port, 0, &priv->asynContext, NULL);
|
status = pasynOctetSyncIO->connect(port, 0, &priv->asynContext, NULL);
|
||||||
if (status) {
|
if (status) {
|
||||||
asynPrint(dummyUser, ASYN_TRACE_ERROR,
|
asynPrint(dummyUser, ASYN_TRACE_ERROR,
|
||||||
@ -384,9 +385,13 @@ static asynStatus el737_transactCommand(EL737priv *priv,char command[COMLEN],cha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if(errno == EAGAIN){
|
||||||
|
errlogPrintf("Lost response to %s with EAGAIN\n", command);
|
||||||
} else {
|
} else {
|
||||||
strncpy(message,"Lost communication",sizeof(message));
|
strncpy(message,"Lost communication",sizeof(message));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(priv->dbInit){
|
if(priv->dbInit){
|
||||||
dbStatus = dbPutField(&priv->msgTxt, DBR_STRING,message, 1);
|
dbStatus = dbPutField(&priv->msgTxt, DBR_STRING,message, 1);
|
||||||
if(dbStatus!= 0){
|
if(dbStatus!= 0){
|
||||||
@ -451,7 +456,7 @@ static void runEvents(EL737priv *priv)
|
|||||||
if(priv->sendThreshold == 1) {
|
if(priv->sendThreshold == 1) {
|
||||||
// fallback when we do not have the DB fields or threshCounter is invalid
|
// fallback when we do not have the DB fields or threshCounter is invalid
|
||||||
if(priv->presets[THRESHMON] <= 0) {
|
if(priv->presets[THRESHMON] <= 0) {
|
||||||
errlogPrintf("Invalid threshold preset monitor %ld, no threshold sent", priv->presets[THRESHMON]);
|
errlogPrintf("Invalid threshold preset monitor %ld, no threshold sent\n", priv->presets[THRESHMON]);
|
||||||
} else {
|
} else {
|
||||||
sprintf(command,"DL %d %d", (int)priv->presets[THRESHMON],
|
sprintf(command,"DL %d %d", (int)priv->presets[THRESHMON],
|
||||||
(int)priv->presets[THRESHVAL]);
|
(int)priv->presets[THRESHVAL]);
|
||||||
@ -506,8 +511,12 @@ static void updateValues(EL737priv *priv)
|
|||||||
strcpy(command,"RA");
|
strcpy(command,"RA");
|
||||||
status = el737_transactCommand(priv,command,reply);
|
status = el737_transactCommand(priv,command,reply);
|
||||||
if(status != asynSuccess){
|
if(status != asynSuccess){
|
||||||
|
if(errno == EAGAIN){
|
||||||
|
errlogPrintf("devScalerEL737::el737Thread lost response to %s with EAGAIN\n", command);
|
||||||
|
} else {
|
||||||
errlogPrintf("devScalerEL737::el737Thread communication problem %s, errno = %d\n",
|
errlogPrintf("devScalerEL737::el737Thread communication problem %s, errno = %d\n",
|
||||||
priv->asynContext->errorMessage, errno);
|
priv->asynContext->errorMessage, errno);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
status = sscanf(reply, "%f %ld %ld %ld %ld %ld %ld %ld %ld",
|
status = sscanf(reply, "%f %ld %ld %ld %ld %ld %ld %ld %ld",
|
||||||
|
Reference in New Issue
Block a user