refactor(dbus): Parameterize picontrol_device and config_rsc

Replaced hardcoded paths with configurable parameters `picontrol_device`
and `config_rsc` across multiple classes. This improves flexibility,
making the components adaptable to various environments or setups.
Updated corresponding initialization and method implementations to use
these parameters.
This commit is contained in:
2025-04-19 08:21:24 +02:00
parent 4c1dc1c9b5
commit a4ccb9081f
3 changed files with 17 additions and 9 deletions

View File

@@ -27,10 +27,11 @@ class InterfacePiControl:
NotifyDriverReset = signal()
def __init__(self):
self.pi_control = "/dev/piControl0"
def __init__(self, picontrol_device: str, config_rsc: str):
self.picontrol_device = picontrol_device
self.config_rsc = config_rsc
self.wd_reset_driver = ResetDriverWatchdog(self.pi_control)
self.wd_reset_driver = ResetDriverWatchdog(self.picontrol_device)
self.wd_reset_driver.register_call(self.notify_reset_driver)
def notify_reset_driver(self):
@@ -40,9 +41,9 @@ class InterfacePiControl:
log.debug("enter InterfacePiControl.ResetDriver")
try:
fd = os.open(self.pi_control, os.O_WRONLY)
fd = os.open(self.picontrol_device, os.O_WRONLY)
except Exception as e:
log.warning(f"could not open ${self.pi_control} to reset driver")
log.warning(f"could not open ${self.picontrol_device} to reset driver")
raise e
execption = None