EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: ASYN Device Support Issue
From: Mark Rivers <[email protected]>
To: "'Ralph Lange'" <[email protected]>
Cc: "'EPICS Core-Talk'" <[email protected]>
Date: Thu, 1 Oct 2015 14:53:53 +0000
I have another question.  What does EPICS base do when the process() routine for an input record returns an error?  Is there a specific error code it should return, or is any non-zero value OK?

Mark


-----Original Message-----
From: Mark Rivers 
Sent: Thursday, October 01, 2015 9:51 AM
To: 'Ralph Lange'
Cc: EPICS Core-Talk
Subject: RE: ASYN Device Support Issue

Hi Ralph,

What version of asyn are you using?   

Does the record correctly set the alarm status when the queueRequest fails?  I think it should.

The github master branch already has a change so that there are only messages printed when queueRequest first fails and then another when it succeeds again.

Here is a possible fix to the problems you found (i.e. returning success and setting value when queueRequest fails)

diff --git a/asyn/devEpics/devAsynInt32.c b/asyn/devEpics/devAsynInt32.c
index 054cf83..162c932 100644
--- a/asyn/devEpics/devAsynInt32.c
+++ b/asyn/devEpics/devAsynInt32.c
@@ -1075,18 +1075,19 @@ static long processMbbi(mbbiRecord *pr)
         if(pPvt->canBlock) pr->pact = 0;
         reportQueueRequestStatus(pPvt, status);
     }
-    pr->rval = pPvt->result.value & pr->mask;
-    pr->time = pPvt->result.time;
     if(pPvt->result.status==asynSuccess) {
         pr->udf=0;
+        pr->rval = pPvt->result.value & pr->mask;
+        pr->time = pPvt->result.time;
     }
     else {
         pasynEpicsUtils->asynStatusToEpicsAlarm(pPvt->result.status, READ_ALARM, &pPvt->alarmStat,
                                                 INVALID_ALARM, &pPvt->alarmSevr);
         (void)recGblSetSevr(pr, pPvt->alarmStat, pPvt->alarmSevr);
     }
+    status = pPvt->result.status;
     pPvt->result.status = asynSuccess;
-    return 0;
+    return status;
 }

reportQueueRequestStatus() copies "status" into pPvt->result.status, so pPvt->result.status will contain the result of pasynManager->queueRequest().

If queueRequest succeeds then pPvt->result.status will contain either the status returned by pDriver->pasynInt32->read(), or by the pasynUser->auxStatus field for an interrupt callback.

My change would leave both the rval and the timestamp unmodified whenever pPvt->result.status is not asynSuccess.  Is this correct?  Should the timestamp also be left unchanged if there is an error?

The code at the end is needed because we want to return the status, but for reasons I don't recall we need to set pPvt->result.status back to asynSuccess before returning.

Mark


-----Original Message-----
From: Ralph Lange [mailto:[email protected]] 
Sent: Thursday, October 01, 2015 8:08 AM
To: Mark Rivers
Cc: EPICS Core-Talk
Subject: ASYN Device Support Issue

Hi Mark,

The processRrrr() routines of the ASYN Device support for input records 
always set the VAL (or RVAL) field and return success, even if the call 
to queueRequest() acquiring the value fails.

In our case, with a non-blocking ASYN driver for a PXIe board, the RVAL 
field of the mbbi record showing the board status is always set to 0 (= 
"OK"), even when there is no such board present and the device never 
connects.
We are pre-setting the database with 4 = "no board", but that gets 
overwritten with 0 ="OK" at every processing.

That doesn't seem right, does it?
Shouldn't the process routine leave the value unchanged and return an 
error when reading fails?

Thanks a lot,
~Ralph


Replies:
Re: ASYN Device Support Issue Andrew Johnson
References:
ASYN Device Support Issue Ralph Lange
RE: ASYN Device Support Issue Mark Rivers

Navigate by Date:
Prev: RE: ASYN Device Support Issue Mark Rivers
Next: Re: ASYN Device Support Issue Andrew Johnson
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: ASYN Device Support Issue Mark Rivers
Next: Re: ASYN Device Support Issue Andrew Johnson
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 16 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·