halscope: fix "loadrt scope_rt failed" when reopening the scope - #4356
Open
grandixximo wants to merge 1 commit into
Open
halscope: fix "loadrt scope_rt failed" when reopening the scope#4356grandixximo wants to merge 1 commit into
grandixximo wants to merge 1 commit into
Conversation
Closing halscope leaves scope_rt loaded, so every launch after the first has to detect that the realtime part is already there and skip the loadrt. That detection broke in d88d10d: the funct lookup halpr_find_funct_by_name("scope.sample") was replaced with the component lookup hal_comp_by_name("scope.sample", NULL). No component is named "scope.sample" (the component is "scope_rt", "scope.sample" is the funct it exports), so the lookup always returns -ENOENT and halscope always runs "halcmd loadrt scope_rt". On the second launch that loadrt fails because scope_rt is already loaded, and halscope exits immediately with "loadrt scope_rt failed". From a GUI such as AXIS ("Machine" > "Hal Scope") the window simply never appears again until LinuxCNC is restarted. Look the funct up with hal_list_funct() instead, the same way scope_horiz.c already does, which restores the original semantics.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reopening halscope fails after the first time: the window never appears again and the terminal shows
loadrt scope_rt failed. From AXIS (Machine>Hal Scope) it just looks like nothing happens until LinuxCNC is restarted.Regression from d88d10d.
scope.cchecks whether the realtime half is already loaded before runningloadrt scope_rt, and that check was converted from a funct lookup to a component lookup:There is no component named
scope.sample. The component isscope_rt,scope.sampleis the funct it exports, so the lookup always returns-ENOENTand halscope always runshalcmd loadrt scope_rt.Closing halscope does not unload
scope_rt, it stays resident and attached to the thread. On the next launch theloadrttherefore fails and halscope callsexit(1)before creating its window.scope_horiz.cwas converted correctly in the same commit, usinghal_list_funct(). This does the same inscope.c, restoring the original semantics.Tested against a live HAL under Xvfb, closing the window with
WM_DELETE_WINDOWbetween launches:loadrt scope_rt failed, exitsscope.samplestays attached to the servo thread across all three, and thehalscopecomponent is removed from HAL on each close.