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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user