--- devAsynOctet.c 2012-06-25 15:20:07.000000000 -0700
+++ devAsynOctet.c.proposed 2012-11-12 12:55:29.000000000 -0800
@@ -657,17 +657,21 @@
static void callbackWfRead(asynUser *pasynUser)
{
devPvt *pdevPvt = (devPvt *)pasynUser->userPvt;
waveformRecord *pwf = (waveformRecord *)pdevPvt->precord;
size_t nBytesRead;
asynStatus status;
status = readIt(pasynUser,pwf->bptr,pwf->nelm,&nBytesRead);
- if(status==asynSuccess) pwf->nord = nBytesRead;
+ if(status==asynSuccess) {
+ pwf->nord = nBytesRead;
+ if (pwf->nelm > pwf->nord)
+ *((char *)pwf->bptr + pwf->nord) = '\0';
+ }
finish((dbCommon *)pwf);
}
static long initWfWrite(waveformRecord *pwf)
{
asynStatus status;
devPvt *pdevPvt;
Hi Andrew,
I will change asynPortDriver so that the setStringParam() method adds a Nil and passes that length to device support on readOctet or asynOctet callbacks. That will fix the problem with areaDetector, which is probably the main driver class using long strings for path names, etc.
This cannot be moved up to asynWfOctetRead/asynWfOctetWrite device support in asyn/devEpics/devAsynOctet.c, because the asynOctet support for the waveform record needs to be able to handle binary data. However, we could add a new device support in there that was specifically for strings, e.g. asynWfOctetStringRead/asynWfOctetStringWrite. These could enforce the Nils in both directions.