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;
|
||||
return 0;
|
||||
}
|
||||
pasynManager->autoConnect(dummyUser, 1);
|
||||
status = pasynOctetSyncIO->connect(port, 0, &priv->asynContext, NULL);
|
||||
if (status) {
|
||||
asynPrint(dummyUser, ASYN_TRACE_ERROR,
|
||||
@ -385,7 +386,11 @@ static asynStatus el737_transactCommand(EL737priv *priv,char command[COMLEN],cha
|
||||
}
|
||||
}
|
||||
} else {
|
||||
strncpy(message,"Lost communication",sizeof(message));
|
||||
if(errno == EAGAIN){
|
||||
errlogPrintf("Lost response to %s with EAGAIN\n", command);
|
||||
} else {
|
||||
strncpy(message,"Lost communication",sizeof(message));
|
||||
}
|
||||
}
|
||||
if(priv->dbInit){
|
||||
dbStatus = dbPutField(&priv->msgTxt, DBR_STRING,message, 1);
|
||||
@ -451,7 +456,7 @@ static void runEvents(EL737priv *priv)
|
||||
if(priv->sendThreshold == 1) {
|
||||
// fallback when we do not have the DB fields or threshCounter is invalid
|
||||
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 {
|
||||
sprintf(command,"DL %d %d", (int)priv->presets[THRESHMON],
|
||||
(int)priv->presets[THRESHVAL]);
|
||||
@ -506,8 +511,12 @@ static void updateValues(EL737priv *priv)
|
||||
strcpy(command,"RA");
|
||||
status = el737_transactCommand(priv,command,reply);
|
||||
if(status != asynSuccess){
|
||||
errlogPrintf("devScalerEL737::el737Thread communication problem %s, errno = %d\n",
|
||||
priv->asynContext->errorMessage, errno);
|
||||
if(errno == EAGAIN){
|
||||
errlogPrintf("devScalerEL737::el737Thread lost response to %s with EAGAIN\n", command);
|
||||
} else {
|
||||
errlogPrintf("devScalerEL737::el737Thread communication problem %s, errno = %d\n",
|
||||
priv->asynContext->errorMessage, errno);
|
||||
}
|
||||
return;
|
||||
}
|
||||
status = sscanf(reply, "%f %ld %ld %ld %ld %ld %ld %ld %ld",
|
||||
|
Reference in New Issue
Block a user