From 9bbcb1547cfd9f24f146619e6b89224daabc155c Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Wed, 29 Nov 2023 13:22:38 +0100 Subject: [PATCH] python: Fix Channel.read() / Channel.write() Channel.read() was using an undefined variable; and both methods were using an invalid prototype for the underlying C function. Signed-off-by: Paul Cercueil --- bindings/python/iio.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bindings/python/iio.py b/bindings/python/iio.py index 208799b01..441740422 100644 --- a/bindings/python/iio.py +++ b/bindings/python/iio.py @@ -572,7 +572,7 @@ class ChannelType(Enum): _c_read.restype = c_ssize_t _c_read.argtypes = ( _ChannelPtr, - _BufferPtr, + _BlockPtr, c_void_p, c_size_t, c_bool, @@ -582,7 +582,7 @@ class ChannelType(Enum): _c_write.restype = c_ssize_t _c_write.argtypes = ( _ChannelPtr, - _BufferPtr, + _BlockPtr, c_void_p, c_size_t, c_bool, @@ -853,7 +853,7 @@ def read(self, block, raw=False): returns: type=bytearray An array containing the samples for this channel """ - array = bytearray(buf._length) + array = bytearray(len(block)) mytype = c_char * len(array) c_array = mytype.from_buffer(array) length = _c_read(self._channel, block._block, c_array, len(array), raw)