Skip to content

Conversation

@andrewstarritt
Copy link

…and lso.
Impacted file: devsupApp/src/devsup/init.py
All worked when I tested on my system: rocky 8 using base-7.0.7

Comment on lines +81 to +85
device(int64in, INST_IO, pydevsupComIn, "Python Device")
device(int64out, INST_IO, pydevsupComOut, "Python Device")
device(lsi, INST_IO, pydevsupComIn, "Python Device")
device(lso, INST_IO, pydevsupComOut, "Python Device")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use of these record types needs needs to be conditional on epics-base version.

  • lsi & lso: >= 3.15.0.2
  • int64in && int64out: >= 3.16.1

EPICS_VERSION and friends are already imported into this file.

Also, if you are willing. @pheest has pointed out that my usage of NamedTemporaryFile() does not work on Windows. He suggested replacing usage of NamedTemporaryFile() with one or more static .dbd files installed alongside this __init__.py and loaded using a path computed from __file__. This could be combined, or a separate change.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be precise, what didn't work on Windows was opening the file for both write and read.
I resolved the issue by opening the file for write, closing it, re-opening it for read, then deleted it.

But since the file doesn't appear to have any variable content, I don't think there is a reason to use a temporary file.

@pheest
Copy link
Collaborator

pheest commented Aug 23, 2023

I have attempted to use the lsi data type, but I could not get this to work.
I note that dbfield.c includes:
strncpy(dest, fld, MAX_STRING_SIZE);
which would crop strings of more than 40 characters.
However, I wasn't able to get any string value at all when using the lsi type - the record remained empty both for string of less than, and more than, 40 characters.
I wasn't able to determine the reason - no error was recorded.

@pheest
Copy link
Collaborator

pheest commented Aug 31, 2023

I have the lsi type working.

  1. strncpy(dest, fld, MAX_STRING_SIZE) can be replaced with strncpy(dest, fld, self->addr.field_size) in order to accommodate a variable-length array.
  2. The record length in lsiRecord.c defaults to 0 and is set within the 'special' function with the comment:
    /* We set prec->len here and not in put_array_info()
    • because that does not get called if the put was
    • done using a DBR_STRING type.
      */
      prec->len = strlen(prec->val) + 1;
      But the function wasn't called from dbfield.c, so the string size remained 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants