machinekit-hal icon indicating copy to clipboard operation
machinekit-hal copied to clipboard

HAL pin cannot be owned in new-style Python API

Open machinekoder opened this issue 7 years ago • 1 comments

A pin created via the from machinekit import hal API cannot be owned and therefore not be used to create userland components. E.g.:

self.halcomp = hal.Component(self.compname)
self.halpin = self.parent_comp.newpin(self.name, self.type, self.dir)
self.halpin.set(self.local_pin_value)

Throws the error:

RuntimeError: cannot set value of linked pin <pin name>

machinekoder avatar Nov 29 '18 13:11 machinekoder

Fix either by adding an owned flag to the HalPin or creating a OwnedHalPin class returned by newpin.

machinekoder avatar Nov 29 '18 13:11 machinekoder