From e7b70247c3933433816f51f7ae5c19302dce0e65 Mon Sep 17 00:00:00 2001 From: Alexandre Bailon Date: Fri, 17 Apr 2026 16:59:10 +0200 Subject: [PATCH] jumpstarter-driver-gpio: Add read method required by PowerInterface This addresses the following issue: TypeError: Can't instantiate abstract class PowerSwitch without an implementation for abstract method 'read' This adds the read method that will raise an exception because we can't get this kind of data from a gpio. Signed-off-by: Alexandre Bailon (cherry picked from commit f0ba0c1dd51bfcbf810ab9b72b9a334da93bfac3) --- .../jumpstarter_driver_gpiod/driver.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/python/packages/jumpstarter-driver-gpiod/jumpstarter_driver_gpiod/driver.py b/python/packages/jumpstarter-driver-gpiod/jumpstarter_driver_gpiod/driver.py index dd239a7db..adbcfc6bf 100644 --- a/python/packages/jumpstarter-driver-gpiod/jumpstarter_driver_gpiod/driver.py +++ b/python/packages/jumpstarter-driver-gpiod/jumpstarter_driver_gpiod/driver.py @@ -1,6 +1,7 @@ from __future__ import annotations import time +from collections.abc import Generator from dataclasses import dataclass, field try: @@ -8,6 +9,7 @@ except ImportError: gpiod = None +from jumpstarter_driver_power.common import PowerReading from jumpstarter_driver_power.driver import PowerInterface from jumpstarter_driver_gpiod.client import PinState @@ -236,3 +238,8 @@ def on(self) -> None: def off(self) -> None: """Switch off the power""" DigitalOutput.off(self) + + @export + def read(self) -> Generator[PowerReading, None, None]: + raise NotImplementedError + yield # makes this a generator function