public inbox for linux-gpio@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH libgpiod 1/2] bindings: python: properly pass event clock settings
@ 2024-07-31 10:46 Bartosz Golaszewski
  2024-07-31 10:46 ` [PATCH libgpiod 2/2] bindings: python: tests: check that event clock is property set in request Bartosz Golaszewski
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2024-07-31 10:46 UTC (permalink / raw)
  To: Benjamin Cabé, Kent Gibson, Linus Walleij
  Cc: linux-gpio, Bartosz Golaszewski

From: Benjamin Cabé <kartben@gmail.com>

Python binding was ignoring event_clock line setting.

Signed-off-by: Benjamin Cabé <kartben@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 bindings/python/gpiod/ext/line-settings.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/bindings/python/gpiod/ext/line-settings.c b/bindings/python/gpiod/ext/line-settings.c
index 2cacbef..650235e 100644
--- a/bindings/python/gpiod/ext/line-settings.c
+++ b/bindings/python/gpiod/ext/line-settings.c
@@ -79,6 +79,10 @@ line_settings_init(line_settings_object *self, PyObject *args, PyObject *kwargs)
 	if (ret)
 		return set_error();
 
+	ret = gpiod_line_settings_set_event_clock(self->settings, event_clock);
+	if (ret)
+		return set_error();
+
 	return 0;
 }
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH libgpiod 2/2] bindings: python: tests: check that event clock is property set in request
  2024-07-31 10:46 [PATCH libgpiod 1/2] bindings: python: properly pass event clock settings Bartosz Golaszewski
@ 2024-07-31 10:46 ` Bartosz Golaszewski
  2024-08-01  0:07 ` [PATCH libgpiod 1/2] bindings: python: properly pass event clock settings Kent Gibson
  2024-08-01  8:27 ` Bartosz Golaszewski
  2 siblings, 0 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2024-07-31 10:46 UTC (permalink / raw)
  To: Benjamin Cabé, Kent Gibson, Linus Walleij
  Cc: linux-gpio, Bartosz Golaszewski

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

We currently only have a test-case that checks if the event clock
property is correctly set in the LineSettings object but not whether it
is actually passed to the line request. Extend the existing test-case for
line requests to account for event clocks as well.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 bindings/python/tests/tests_line_request.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/bindings/python/tests/tests_line_request.py b/bindings/python/tests/tests_line_request.py
index c79a324..dce5941 100644
--- a/bindings/python/tests/tests_line_request.py
+++ b/bindings/python/tests/tests_line_request.py
@@ -5,7 +5,7 @@ import errno
 import gpiod
 
 from . import gpiosim
-from gpiod.line import Direction, Drive, Edge, Value
+from gpiod.line import Clock, Direction, Drive, Edge, Value
 from unittest import TestCase
 
 Pull = gpiosim.Chip.Pull
@@ -302,12 +302,15 @@ class LineRequestComplexConfig(TestCase):
                         direction=Direction.OUTPUT, output_value=Value.ACTIVE
                     ),
                     (1, 3, 5): gpiod.LineSettings(
-                        direction=Direction.INPUT, edge_detection=Edge.BOTH
+                        direction=Direction.INPUT,
+                        edge_detection=Edge.BOTH,
+                        event_clock=Clock.REALTIME,
                     ),
                 },
             ) as req:
                 self.assertEqual(chip.get_line_info(2).direction, Direction.OUTPUT)
                 self.assertEqual(chip.get_line_info(3).edge_detection, Edge.BOTH)
+                self.assertEqual(chip.get_line_info(5).event_clock, Clock.REALTIME)
 
 
 class LineRequestMixedConfigByName(TestCase):
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH libgpiod 1/2] bindings: python: properly pass event clock settings
  2024-07-31 10:46 [PATCH libgpiod 1/2] bindings: python: properly pass event clock settings Bartosz Golaszewski
  2024-07-31 10:46 ` [PATCH libgpiod 2/2] bindings: python: tests: check that event clock is property set in request Bartosz Golaszewski
@ 2024-08-01  0:07 ` Kent Gibson
  2024-08-01  7:55   ` Bartosz Golaszewski
  2024-08-01  8:27 ` Bartosz Golaszewski
  2 siblings, 1 reply; 5+ messages in thread
From: Kent Gibson @ 2024-08-01  0:07 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Benjamin Cabé, Linus Walleij, linux-gpio,
	Bartosz Golaszewski

On Wed, Jul 31, 2024 at 12:46:57PM +0200, Bartosz Golaszewski wrote:
> From: Benjamin Cabé <kartben@gmail.com>
>
> Python binding was ignoring event_clock line setting.
>
> Signed-off-by: Benjamin Cabé <kartben@gmail.com>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
>  bindings/python/gpiod/ext/line-settings.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/bindings/python/gpiod/ext/line-settings.c b/bindings/python/gpiod/ext/line-settings.c
> index 2cacbef..650235e 100644
> --- a/bindings/python/gpiod/ext/line-settings.c
> +++ b/bindings/python/gpiod/ext/line-settings.c
> @@ -79,6 +79,10 @@ line_settings_init(line_settings_object *self, PyObject *args, PyObject *kwargs)
>  	if (ret)
>  		return set_error();
>
> +	ret = gpiod_line_settings_set_event_clock(self->settings, event_clock);
> +	if (ret)
> +		return set_error();
> +
>  	return 0;
>  }
>

I'm ok with this series, but the gap this identifies in test coverage
bothers me - are there any other attributes that are not round-trip tested?
Debounce immediately springs to mind.  Bias?  Drive?  Even active_low?
Maybe add or extend a test case to excerise those in a separate patch?

Reviewed-by: Kent Gibson <warthog618@gmail.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH libgpiod 1/2] bindings: python: properly pass event clock settings
  2024-08-01  0:07 ` [PATCH libgpiod 1/2] bindings: python: properly pass event clock settings Kent Gibson
@ 2024-08-01  7:55   ` Bartosz Golaszewski
  0 siblings, 0 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2024-08-01  7:55 UTC (permalink / raw)
  To: Kent Gibson
  Cc: Benjamin Cabé, Linus Walleij, linux-gpio,
	Bartosz Golaszewski

On Thu, Aug 1, 2024 at 2:08 AM Kent Gibson <warthog618@gmail.com> wrote:
>
> I'm ok with this series, but the gap this identifies in test coverage
> bothers me - are there any other attributes that are not round-trip tested?
> Debounce immediately springs to mind.  Bias?  Drive?  Even active_low?
> Maybe add or extend a test case to excerise those in a separate patch?
>
> Reviewed-by: Kent Gibson <warthog618@gmail.com>

Yeah, it definitely needs doing. I've added it to my TODO list, though
not with the highest priority I admit.

Bart

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH libgpiod 1/2] bindings: python: properly pass event clock settings
  2024-07-31 10:46 [PATCH libgpiod 1/2] bindings: python: properly pass event clock settings Bartosz Golaszewski
  2024-07-31 10:46 ` [PATCH libgpiod 2/2] bindings: python: tests: check that event clock is property set in request Bartosz Golaszewski
  2024-08-01  0:07 ` [PATCH libgpiod 1/2] bindings: python: properly pass event clock settings Kent Gibson
@ 2024-08-01  8:27 ` Bartosz Golaszewski
  2 siblings, 0 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2024-08-01  8:27 UTC (permalink / raw)
  To: Benjamin Cabé, Kent Gibson, Linus Walleij,
	Bartosz Golaszewski
  Cc: Bartosz Golaszewski, linux-gpio

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


On Wed, 31 Jul 2024 12:46:57 +0200, Bartosz Golaszewski wrote:
> Python binding was ignoring event_clock line setting.
> 
> 

Applied, thanks!

[1/2] bindings: python: properly pass event clock settings
      commit: 2f38f92ae27b1427508cf014815ad33029fa6af3
[2/2] bindings: python: tests: check that event clock is property set in request
      commit: 025693a045f82c9c6cefa6b3d91d15ed05721915

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-08-01  8:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-31 10:46 [PATCH libgpiod 1/2] bindings: python: properly pass event clock settings Bartosz Golaszewski
2024-07-31 10:46 ` [PATCH libgpiod 2/2] bindings: python: tests: check that event clock is property set in request Bartosz Golaszewski
2024-08-01  0:07 ` [PATCH libgpiod 1/2] bindings: python: properly pass event clock settings Kent Gibson
2024-08-01  7:55   ` Bartosz Golaszewski
2024-08-01  8:27 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox