EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Bug in Asyn 4-23 drvAsynUSBTMC (with patch)
From: Bruno Martins <[email protected]>
To: "[email protected]" <[email protected]>
Date: Wed, 19 Nov 2014 13:53:11 -0500
Hi all,

I'm using drvAsynUSBTMC to talk to a Tektronix scope and found a bug.

asynOctetRead (in drvAsynUSBTMC.c) tries to fill the passed 'data' pointer with data from 'pdpvt->bufp'. However, if 'maxchars' > 'pdpvt->bufCount'  a new packet will be requested from the USB driver and be saved to 'pdpvt->bufp'. Then, in the next 'for' loop iteration, 'data' will be overwritten.

The fix is to increment 'data' pointer by the appropriate amount. A patch is attached.



Thanks,

Bruno
diff --git a/asyn/drvAsynUSBTMC/drvAsynUSBTMC.c b/asyn/drvAsynUSBTMC/drvAsynUSBTMC.c
index 678fc3c..fca9f56 100644
--- a/asyn/drvAsynUSBTMC/drvAsynUSBTMC.c
+++ b/asyn/drvAsynUSBTMC/drvAsynUSBTMC.c
@@ -798,6 +798,7 @@ asynOctetRead(void *pvt, asynUser *pasynUser,
             maxchars -= nCopy;
             *nbytesTransfered += nCopy;
             pdpvt->bytesReceivedCount += nCopy;
+            data += nCopy;
             if (maxchars == 0)
                 eom |= ASYN_EOM_CNT;
         }

Replies:
Re: Bug in Asyn 4-23 drvAsynUSBTMC (with patch) Eric Norum

Navigate by Date:
Prev: Re: how to execute 'mcaget/mcaopen/...' command on IOCSHELL J. Lewis Muir
Next: Re: Bug in Asyn 4-23 drvAsynUSBTMC (with patch) Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: how to execute 'mcaget/mcaopen/...' command on IOCSHELL J. Lewis Muir
Next: Re: Bug in Asyn 4-23 drvAsynUSBTMC (with patch) Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 17 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·