newinst in opcua_postgui.hal silently breaks the OPC UA wiring on stock LinuxCNC
The file linuxcnc-configs/opcua_postgui.hal contains:
newinst or2 opcua_estop_or
addf opcua_estop_or servo-thread
newinst only exists in Machinekit and in very old experimental LinuxCNC branches. On stock LinuxCNC (which this project builds from source, unmodified, per the Dockerfile) the newinst command has been compiled out of halcmd since version 2.2 (#if 0 in halcmd_commands.c).
What happens at runtime
halcmd processes the file top-down. loadusr succeeds and the OPC UA client loads.
- The
newinst line fails with an unknown-command error, and halcmd -f aborts the rest of the file.
- All
net commands below it never execute.
Because this is a POSTGUI_HALFILE, the GUI is already up, so the sim appears to run — but the opcua component is loaded-yet-unwired, and the whole SCADA data bridge is silently dead (the only trace is an error in the LinuxCNC log). The validation steps in the README (dashboard status updates, SCADA-triggered E-Stop) cannot pass as written.
Suggested fix
Use a plain counted instance instead, and rename the pins accordingly:
loadrt or2 count=1
addf or2.0 servo-thread
net int-estop-active halui.estop.is-activated => or2.0.in0
net ext-estop-trigger opcua.trigger-estop => or2.0.in1
net estop-is-active or2.0.out => opcua.emergency-stop
(With count=1 the pins are or2.0.in0/in1/out.)
Context: we ran into this while auditing newinst usage for an upcoming LinuxCNC HAL API change — see LinuxCNC/linuxcnc#4259.
newinstinopcua_postgui.halsilently breaks the OPC UA wiring on stock LinuxCNCThe file
linuxcnc-configs/opcua_postgui.halcontains:newinstonly exists in Machinekit and in very old experimental LinuxCNC branches. On stock LinuxCNC (which this project builds from source, unmodified, per the Dockerfile) thenewinstcommand has been compiled out ofhalcmdsince version 2.2 (#if 0inhalcmd_commands.c).What happens at runtime
halcmdprocesses the file top-down.loadusrsucceeds and the OPC UA client loads.newinstline fails with an unknown-command error, andhalcmd -faborts the rest of the file.netcommands below it never execute.Because this is a POSTGUI_HALFILE, the GUI is already up, so the sim appears to run — but the
opcuacomponent is loaded-yet-unwired, and the whole SCADA data bridge is silently dead (the only trace is an error in the LinuxCNC log). The validation steps in the README (dashboard status updates, SCADA-triggered E-Stop) cannot pass as written.Suggested fix
Use a plain counted instance instead, and rename the pins accordingly:
(With
count=1the pins areor2.0.in0/in1/out.)Context: we ran into this while auditing
newinstusage for an upcoming LinuxCNC HAL API change — see LinuxCNC/linuxcnc#4259.