Context
While integrating ioc-tasplot (PyDevice IOC for TAS scan plotting), we hit EPICS’s 40-character string limit when exposing file paths (~90 characters) through PVs.
Investigation showed this is expected EPICS behavior, but the right PyDevice record choice is not obvious from the README alone.
Observation: waveform with FTVL=STRING
PyDevice’s waveform support for FTVL=STRING caps each element at MAX_STRING_SIZE (40), matching EPICS base (epicsTypes.h):
// pydev_waveform.cpp
std::string cval = sval.substr(0, MAX_STRING_SIZE - 1);
That is correct for EPICS string waveforms (an array of fixed 40-char slots), but it is not suitable for a single long pathname.
Question: Could the README explicitly state that FTVL=STRING waveforms are limited to 40 characters per element, and are intended for arrays of short strings, not single long text fields?
What worked: lsi / lso (EPICS 3.15+)
Switching path PVs to lsi/lso with SIZV=255 and enabling pydev315.dbd worked well. PyDevice’s pydev_lsi.cpp / pydev_lso.cpp correctly use rec->sizv for storage.
Remaining friction was on the client side, not PyDevice:
- Plain
caget TAS:Plot:FilePath_RBV → truncated at 40 chars (DBR_STRING)
caget -S TAS:Plot:FilePath_RBV.$ → full path
See EPICS field modifiers ($) and EPICS tech-talk on Phoebus long strings.
Alternative: waveform with FTVL=CHAR
Historically, long text used a CHAR waveform as a byte blob (NORD = length). PyDevice appears to support this, but from Python it means returning byte lists, and Phoebus needs Format=String plus the .$ modifier. For text fields, lsi/lso seem simpler.
Question: Is there a recommended PyDevice pattern for “single long string” PVs today? Our conclusion: prefer lsi/lso over CHAR waveforms for path/error text — please confirm or correct.
Suggested documentation additions
-
Record choice table
| Goal |
Record type |
PyDevice notes |
| Single long string (path, error) |
lsi / lso |
Requires pydev315.dbd; set SIZV; clients use .$ |
| Array of short strings |
waveform FTVL=STRING |
40 chars per element (MAX_STRING_SIZE) |
| Legacy long text blob |
waveform FTVL=CHAR |
NORD = length; less ergonomic from Python |
| Numeric plot data |
waveform FTVL=DOUBLE |
Works well |
-
Note that dbpf / iocsh on lso strings may truncate at 40 chars; use template field(VAL,...) at load time, Python pydev() before iocInit, or CA clients with the .$ modifier.
-
Optional: mention that input lsi/lso readbacks may need field(SCAN, ...) (or I/O Intr) so CA clients see updates without an explicit process trigger.
Environment
- EPICS Base R7.0.7
- PyDevice (vendored in ioc-tasplot
src/)
- Python 3.10
- Clients:
caget/caput, Phoebus Display
Not asking for
A change to make FTVL=STRING hold arbitrary-length strings — that would duplicate lsi/lso and diverge from EPICS record semantics. Documentation and a clear “use lsi/lso for long text” recommendation would be enough.
Context
While integrating ioc-tasplot (PyDevice IOC for TAS scan plotting), we hit EPICS’s 40-character string limit when exposing file paths (~90 characters) through PVs.
Investigation showed this is expected EPICS behavior, but the right PyDevice record choice is not obvious from the README alone.
Observation:
waveformwithFTVL=STRINGPyDevice’s waveform support for
FTVL=STRINGcaps each element atMAX_STRING_SIZE(40), matching EPICS base (epicsTypes.h):That is correct for EPICS string waveforms (an array of fixed 40-char slots), but it is not suitable for a single long pathname.
Question: Could the README explicitly state that
FTVL=STRINGwaveforms are limited to 40 characters per element, and are intended for arrays of short strings, not single long text fields?What worked:
lsi/lso(EPICS 3.15+)Switching path PVs to
lsi/lsowithSIZV=255and enablingpydev315.dbdworked well. PyDevice’spydev_lsi.cpp/pydev_lso.cppcorrectly userec->sizvfor storage.Remaining friction was on the client side, not PyDevice:
caget TAS:Plot:FilePath_RBV→ truncated at 40 chars (DBR_STRING)caget -S TAS:Plot:FilePath_RBV.$→ full pathSee EPICS field modifiers (
$) and EPICS tech-talk on Phoebus long strings.Alternative:
waveformwithFTVL=CHARHistorically, long text used a CHAR waveform as a byte blob (
NORD= length). PyDevice appears to support this, but from Python it means returning byte lists, and Phoebus needsFormat=Stringplus the.$modifier. For text fields,lsi/lsoseem simpler.Question: Is there a recommended PyDevice pattern for “single long string” PVs today? Our conclusion: prefer
lsi/lsoover CHAR waveforms for path/error text — please confirm or correct.Suggested documentation additions
Record choice table
lsi/lsopydev315.dbd; setSIZV; clients use.$waveformFTVL=STRINGMAX_STRING_SIZE)waveformFTVL=CHARNORD= length; less ergonomic from PythonwaveformFTVL=DOUBLENote that
dbpf/iocshonlsostrings may truncate at 40 chars; use templatefield(VAL,...)at load time, Pythonpydev()beforeiocInit, or CA clients with the.$modifier.Optional: mention that input
lsi/lsoreadbacks may needfield(SCAN, ...)(or I/O Intr) so CA clients see updates without an explicit process trigger.Environment
src/)caget/caput, Phoebus DisplayNot asking for
A change to make
FTVL=STRINGhold arbitrary-length strings — that would duplicatelsi/lsoand diverge from EPICS record semantics. Documentation and a clear “uselsi/lsofor long text” recommendation would be enough.