feat: Add support for configurable procimg path
Introduced a new `--procimg` argument to specify the process image path. Updated `MiddlewareDaemon` to dynamically reset D-Bus when `procimg` changes and pass the configured path to bus providers. Signed-off-by: Sven Sager <s.sager@kunbus.com>
This commit is contained in:
@@ -46,6 +46,9 @@ class MiddlewareDaemon:
|
||||
log.debug("enter MiddlewareDaemon._configure")
|
||||
pi.reload_conf()
|
||||
|
||||
if pi.pargs.procimg != self.wd_reset.procimg:
|
||||
self.dbus_stop()
|
||||
|
||||
log.debug("leave MiddlewareDaemon._configure")
|
||||
|
||||
@staticmethod
|
||||
@@ -65,9 +68,15 @@ class MiddlewareDaemon:
|
||||
dbus_running = self.bus_provider and self.bus_provider.is_alive()
|
||||
if not dbus_running:
|
||||
if self.bus_provider_selected is BusProvider.middleware:
|
||||
self.bus_provider = BusProviderMiddleware1(self._get_bus_address())
|
||||
self.bus_provider = BusProviderMiddleware1(
|
||||
dbus_address=self._get_bus_address(),
|
||||
picontrol_device=pi.pargs.procimg,
|
||||
)
|
||||
elif self.bus_provider_selected is BusProvider.ios:
|
||||
self.bus_provider = BusProviderIos1(self._get_bus_address())
|
||||
self.bus_provider = BusProviderIos1(
|
||||
dbus_address=self._get_bus_address(),
|
||||
picontrol_device=pi.pargs.procimg,
|
||||
)
|
||||
else:
|
||||
raise ValueError("Unknown bus provider")
|
||||
self.bus_provider.start()
|
||||
|
||||
@@ -27,6 +27,12 @@ pi.parser.add_argument(
|
||||
default="/etc/{0}/{0}.conf".format(pi.programname),
|
||||
help="application configuration file",
|
||||
)
|
||||
pi.parser.add_argument(
|
||||
"--procimg",
|
||||
dest="procimg",
|
||||
default="/dev/piControl0",
|
||||
help="Path to process image",
|
||||
)
|
||||
pi.parser.add_argument(
|
||||
"bus_provider",
|
||||
default="middleware",
|
||||
|
||||
Reference in New Issue
Block a user