From 19c50d4c3db32668b4d5bebfb7e6d15e87cd10f4 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Fri, 5 Jun 2020 16:01:14 +0200 Subject: [PATCH] fix aai and waveform soft device support to support reading empty arrays --- modules/database/src/std/dev/devAaiSoft.c | 11 ++++++++--- modules/database/src/std/dev/devWfSoft.c | 7 +++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/modules/database/src/std/dev/devAaiSoft.c b/modules/database/src/std/dev/devAaiSoft.c index 1f5765650..0fbb1148e 100644 --- a/modules/database/src/std/dev/devAaiSoft.c +++ b/modules/database/src/std/dev/devAaiSoft.c @@ -60,9 +60,10 @@ static long init_record(dbCommon *pcommon) } status = dbLoadLinkArray(plink, prec->ftvl, prec->bptr, &nRequest); - if (!status && nRequest > 0) { + if (!status) { prec->nord = nRequest; prec->udf = FALSE; + return status; } } return 0; @@ -74,7 +75,7 @@ static long readLocked(struct link *pinp, void *dummy) long nRequest = prec->nelm; long status = dbGetLink(pinp, prec->ftvl, prec->bptr, 0, &nRequest); - if (!status && nRequest > 0) { + if (!status) { prec->nord = nRequest; prec->udf = FALSE; @@ -89,8 +90,12 @@ static long read_aai(aaiRecord *prec) { epicsUInt32 nord = prec->nord; struct link *pinp = prec->simm == menuYesNoYES ? &prec->siol : &prec->inp; - long status = dbLinkDoLocked(pinp, readLocked, NULL); + long status; + if (dbLinkIsConstant(pinp)) + return 0; + + status = dbLinkDoLocked(pinp, readLocked, NULL); if (status == S_db_noLSET) status = readLocked(pinp, NULL); diff --git a/modules/database/src/std/dev/devWfSoft.c b/modules/database/src/std/dev/devWfSoft.c index 0a089b831..29a617be3 100644 --- a/modules/database/src/std/dev/devWfSoft.c +++ b/modules/database/src/std/dev/devWfSoft.c @@ -41,7 +41,7 @@ static long init_record(dbCommon *pcommon) long nelm = prec->nelm; long status = dbLoadLinkArray(&prec->inp, prec->ftvl, prec->bptr, &nelm); - if (!status && nelm > 0) { + if (!status) { prec->nord = nelm; prec->udf = FALSE; } @@ -77,11 +77,14 @@ static long read_wf(waveformRecord *prec) rt.ptime = (dbLinkIsConstant(&prec->tsel) && prec->tse == epicsTimeEventDeviceTime) ? &prec->time : NULL; + if (dbLinkIsConstant(&prec->inp)) + return 0; + status = dbLinkDoLocked(&prec->inp, readLocked, &rt); if (status == S_db_noLSET) status = readLocked(&prec->inp, &rt); - if (!status && rt.nRequest > 0) { + if (!status) { prec->nord = rt.nRequest; prec->udf = FALSE; if (nord != prec->nord)