Skip to content

Commit

Permalink
iio.py: fix Trigger instantiation
Browse files Browse the repository at this point in the history
Trigger() is being passed device contents, but no context, and therefore
fails like so:

|>>> adc._ctrl.trigger
|Traceback (most recent call last):
|  File "<stdin>", line 1, in <module>
|  File "/home/baylibre/git/pyadi-iio/venv/lib/python3.10/site-packages/iio.py", line 1281, in _get_trigger
|    trig = Trigger(value.contents)
|TypeError: Trigger.__init__() missing 1 required positional argument: '_device'

Pass self.ctx as the first argument so that the trigger is properly
instantiated.

Fixes #1107.

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
  • Loading branch information
threexc authored and pcercuei committed Dec 20, 2023
1 parent 1a3a6e1 commit 61fdbe7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bindings/python/iio.py
Original file line number Diff line number Diff line change
Expand Up @@ -1346,7 +1346,7 @@ def _set_trigger(self, trigger):
def _get_trigger(self):
value = _DevicePtr()
_d_get_trigger(self._device, _byref(value))
trig = Trigger(value.contents)
trig = Trigger(self.ctx, value.contents)

for dev in self.ctx.devices:
if trig.id == dev.id:
Expand Down

0 comments on commit 61fdbe7

Please sign in to comment.