Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Choices field incorrect for menu and device fields. WAS: get of record subfield succeeds (with surprising results) #8

Closed
ralphlange opened this issue Jun 10, 2015 · 4 comments
Assignees

Comments

@ralphlange
Copy link
Contributor

From Dave Hickin <david.hickin_AT_diamond.ac.uk>:

If you do a pvget with the channel name equal to a field of a v3 record (with pvaSrv being used) then the get succeeds.

Sometimes the result is a scalar:

$ eget -i -r "value" ColorMode.RTYP
ColorMode.RTYP
epics:nt/NTScalar:1.0
string value mbbo

Other times the field value is converted to an enum using the choices of the PV (i.e.ZRST etc):

$ caget -n ColorMode.DTYP
ColorMode.DTYP 3
$ eget -i ColorMode.DTYP
ColorMode.DTYP
epics:nt/NTEnum:1.0
enum_t value
int index 3
string[] choices [Mono,RGB1,RGB2,RGB3]

So the results can be surprising:

$ eget Acquire.RTYP Acquire.PINI Acquire.DISS Acquire.DISA
Acquire.RTYP busy
Acquire.PINI Done
Acquire.DISS Done
Acquire.DISA 0
$ eget Acquire.DTYP
Segmentation fault (core dumped)

@ralphlange
Copy link
Contributor Author

From Dave Hickin <david.hickin_AT_diamond.ac.uk>:

Matej has fixed the eget seg fault issue so an eget to the above fields now gives:

$eget adImSrv:sim:Acquire.RTYP ... adImSrv:sim:Acquire.DTYP
adImSrv:sim:Acquire.RTYP busy
...
adImSrv:sim:Acquire.DTYP 2

@ralphlange
Copy link
Contributor Author

Does that mean the bug is fixed?

The two first issues you are describing do look not completely random to me, given that .RTYP is a string and .DTYP is an enum.
The choices seem to be from a different field, though. Is that the bug you want to report?

If it is about the eget tool segfaulting, I am not sure I am the right owner of the ticket.

@ralphlange
Copy link
Contributor Author

From Dave Hickin <david.hickin_AT_diamond.ac.uk>:

Yes, it appears that the issue is that for a channel to a record field with enumerated type other than a VAL field the value.index correctly gets the index from the field, but the value.choices gets the values from the VAL field.

@ralphlange ralphlange self-assigned this Jun 10, 2015
@dhickin dhickin assigned dhickin and unassigned ralphlange Sep 10, 2015
dhickin added a commit to dhickin/pvaSrv that referenced this issue Sep 11, 2015
When creating a pvAccess channel to a field of a record of an enumerated
type PV whose DBF type is DBF_DEVICE or DBF_MENU, for example, the DTYP
or SCAN fields of a bi/bo/mbbi/mbbo record, and performing an operation
involving its "values.choices" field (Channel Get,Put or Monitor) the
"choices" field is filled in incorrectly with the values from the
record's "VAL" field. Fix this for EPICS base R3.14. R3.15 requires a
separate fix.
@dhickin
Copy link
Contributor

dhickin commented Sep 14, 2015

I've retitled this with something more meaningful now I understand what's happening.

For channels to DBF_MENU and DBF_DEVICE fields of a record whose VAL field is a DBF_ENUM the "value.choices" field is being filled in with the strings for the VAL field. For 3.14 this is fixed for example by testing the DBF type against DBF_ENUM.

.

For 3.15 there is the additional problem that dbChannelFinalFieldType() returns the DBR type instead of the DBF type (#17) . I'll treat that separately in that issue.

@dhickin dhickin changed the title get of record subfield succeeds (with surprising results) Choices field incorrect for menu and device fields. WAS: get of record subfield succeeds (with surprising results) Sep 14, 2015
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

No branches or pull requests

2 participants