1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 <2009> 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 <2009> 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | RE: asyn R4.10, R4.11, R4.12 |
From: | "Mark Rivers" <[email protected]> |
To: | "TECHTALK Tech-Talk" <[email protected]> |
Cc: | Eric Norum <[email protected]> |
Date: | Mon, 7 Dec 2009 15:54:07 -0600 |
Folks, The attached patch (also below in case attachments don’t
work) fixes a problem in asynRecord.c that was introduced when the readRaw and
writeRaw functions were removed from asynOctet in R4-10. The problem
causes binary writes and reads to fail if the underlying asynOctet driver or
interpose interface does not implement both the getOutputEos or getInputEos
methods. Mark Index: asynRecord.c =================================================================== RCS file:
/net/phoebus/epicsmgr/cvsroot/epics/modules/soft/asyn/asyn/asynRecord/asynRecord.c,v retrieving revision 1.82 diff -u -r1.82 asynRecord.c --- asynRecord.c 28
May 2008 18:58:51 -0000 1.82 +++ asynRecord.c 7 Dec
2009 17:15:08 -0000 @@ -1476,18 +1476,16 @@
status = pasynRecPvt->pasynOctet->getOutputEos(
pasynRecPvt->asynOctetPvt,pasynUser, saveEosBuf,sizeof
saveEosBuf,&saveEosLen); -
if (status != asynSuccess) { -
reportError(pasynRec, status, "EOS TOO LONG"); -
return; -
} +
/* getOutputEos can return an error if the driver does not implement it */ +
if (status != asynSuccess) saveEosLen = 0;
if (saveEosLen)
pasynRecPvt->pasynOctet->setOutputEos(pasynRecPvt->asynOctetPvt, -
pasynUser,NULL,0); +
pasynUser,NULL,0);
status = pasynRecPvt->pasynOctet->write(pasynRecPvt->asynOctetPvt, -
pasynUser, outptr, nwrite, &nbytesTransfered); +
pasynUser, outptr, nwrite, &nbytesTransfered);
if (saveEosLen)
pasynRecPvt->pasynOctet->setOutputEos(pasynRecPvt->asynOctetPvt, -
pasynUser,saveEosBuf,saveEosLen); +
pasynUser,saveEosBuf,saveEosLen);
} else {
/* ASCII or Hybrid mode */
status = pasynRecPvt->pasynOctet->write(pasynRecPvt->asynOctetPvt, @@ -1514,16 +1512,16 @@
status = pasynRecPvt->pasynOctet->getInputEos(
pasynRecPvt->asynOctetPvt,pasynUser,
saveEosBuf,sizeof saveEosBuf,&saveEosLen); -
if (status != asynSuccess) { -
reportError(pasynRec, status, "EOS TOO LONG"); -
return; -
} -
pasynRecPvt->pasynOctet->setInputEos(pasynRecPvt->asynOctetPvt, -
pasynUser,NULL,0); +
/* getInputEos can return an error if the driver does not implement it */ +
if (status != asynSuccess) saveEosLen = 0; +
if (saveEosLen) +
pasynRecPvt->pasynOctet->setInputEos(pasynRecPvt->asynOctetPvt, +
pasynUser,NULL,0);
status = pasynRecPvt->pasynOctet->read(pasynRecPvt->asynOctetPvt,
pasynUser, inptr, nread, &nbytesTransfered,&eomReason); -
pasynRecPvt->pasynOctet->setInputEos(pasynRecPvt->asynOctetPvt, -
pasynUser,saveEosBuf,saveEosLen); +
if (saveEosLen) +
pasynRecPvt->pasynOctet->setInputEos(pasynRecPvt->asynOctetPvt, +
pasynUser,saveEosBuf,saveEosLen);
} else {
/* ASCII or Hybrid mode */
status = pasynRecPvt->pasynOctet->read(pasynRecPvt->asynOctetPvt, From: Mark Rivers Eric, I think I understand the problem. The VXI11 driver is called by the asynGpib driver. The asynGpib
driver only implements asynOctet->set/getInputEos, not
set/getOutputEos. It thus uses the default implementation of the
set/getOutputEos functions in asynOctetBase, which return an error. The asynRecord calls getOutputEos under some conditions. When it
is doing a binary write (OFMT==Binary) if it gets an error return from
getOutputEos it treats it as a serious error. I can think of 2 possible solutions to the problem: 1) Make the default implementation of the getEos functions not
return an error, and just return an eoslen of 0. 2) Change the asynRecord to tolerate an error return from
getOutputEos. My patch for Zen did 1. Perhaps 2 is better, or perhaps both 1
and 2? Mark From: Eric
Norum [mailto:[email protected]] Why does a patch to asynOctet have this effect?
The code's using VXI-11, which does provide the get/set EOS
methods. If the higher level code isn't using these is it not an
indication of a deeper problem? |
Attachment:
asynRecord.patch
Description: asynRecord.patch