epics-modules / ip

APS BCDA synApps module: ip
http://epics-modules.github.io/ip/
Other
3 stars 9 forks source link

tyGSAsynInit: integer args for char variables fail on iocsh #40

Closed kmpeters closed 1 year ago

kmpeters commented 2 years ago

This error occurs on the iocsh:

tyGSAsynInit("serial1",  "UART_0", 0, 9600,'N',1,8,'N',"\n","\n")
serial.cmd line 21: Illegal integer 'N'

But it doesn't occur on the vxWorks shell:

tyGSAsynInit("serial1",  "UART_0", 0, 9600,'N',1,8,'N',"\n","\n")
value = 0 = 0x0
keenanlang commented 2 years ago

The vxWorks shell treats characters as a number type and has implicit conversion to ints, whereas iocsh doesn't have a separate character type, so they are just strings.

Currently, that parameter is set up as an integer value to match the definition of the function in code, I can change it to a string parameter and then take the value of the first character in the string, but that is a functional change to anything that uses tyGSAsynInit on iocsh as it would no longer take in a number.

Searching synApps, there are no files with .cmd or .iocsh suffixes that call tyGSAsynInit, so I think it's fine, but it's possible there is an IOC out there somewhere that may break

MarkRivers commented 2 years ago

I think it is just unlikely that it is being called from iocsh, so I think it is OK to change.

keenanlang commented 2 years ago

Should be fixed with efb06530c357180505b14902b3a6cf80875fa203