Skip to content

hal: Update halmodule to getter/setter and the query API - #4317

Merged
grandixximo merged 1 commit into
LinuxCNC:masterfrom
BsAtHome:halgs_halmodule
Aug 2, 2026
Merged

hal: Update halmodule to getter/setter and the query API#4317
grandixximo merged 1 commit into
LinuxCNC:masterfrom
BsAtHome:halgs_halmodule

Conversation

@BsAtHome

@BsAtHome BsAtHome commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

This moves the current halmodule to getter/setter and uses only the HAL query API.

We cannot move to a new C++ halmodule implementation before everything is in place. We need to retain the infrastructure so we can move forward.

The new port pin creation is enabled (hal_pin_new_port()) using a slightly different signature than what it will become. This is done for compatibility sake because the hal_port_t is already in use and can only be fixed when we break the API. So that will have to wait. In the meantime, we use an intermediate.

Halmodule no longer accesses hal_priv.h. Quite some lines could be removed by using the query API. Also, the new API is much simpler for the halitem and removes the old pin/param/type/direction union stuff.

It is no longer required to create a component before accessing the generic pin/signal access methods. Halmodule will call hal_lib_init() when imported and register a Py_AtExit(hal_lib_exit) to remove the share memory. This also makes the check in hal_lib effective when components are left dangling. At exit it will specify which components were never exited.

You can now do hal.get_value('some.pin.name') immediately after importing the module. The same goes for set_p/set_s. Also, functions get_p/get_s are added. The get_value would test pins/params/signals, whereas other utilities have a split. This is now possible. An added check tests this and also uses the threadbeat for cycle advancement testing (also has a timeout, but that is to guard infinity).

Comment thread src/hal/halmodule.cc Outdated
@grandixximo
grandixximo merged commit 2f447ae into LinuxCNC:master Aug 2, 2026
16 checks passed
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.

2 participants