6 Commits

Author SHA1 Message Date
8db1f59cfe doc(revpiconfig): Docstrings for get_rfkill_index and simple_systemd
The new docstrings provide detailed explanations of the purpose,
parameters, and return values for both functions, improving code
readability and maintainability. This ensures better understanding for
future contributors and reduces ambiguity.
2025-04-22 11:06:32 +02:00
7051eba9b9 doc(revpiconfig): Add docstrings to enums in revpi_config.py
This update introduces detailed docstrings for the `ComputeModuleTypes`
and `ConfigActions` enumeration classes. The docstrings provide
descriptions for each class and their attributes, improving code
readability and maintainability.
2025-04-22 11:06:32 +02:00
04780bd0dd doc(revpiconfig): Add docstrings to RevPiConfig class and methods
Enhance documentation for the `RevPiConfig` class, its methods, and
properties to improve code readability and ease of use. The added
docstrings provide clear explanations of the class's purpose,
attributes, and functionality for developers and users. This update
supports better maintainability and understanding of the codebase.
2025-04-22 11:06:32 +02:00
41fb2b3c61 doc(revpiconfig): Add detailed docstrings to ConfigTxt methods
Enhance the `ConfigTxt` class with comprehensive docstrings for all
methods, providing clear explanations of their functionality,
parameters, and return values. This improves code readability and
facilitates easier maintenance and understanding for future developers.
2025-04-22 11:06:32 +02:00
41d9b13e71 fix(dbus): Update systemd interface and path handling
Revised DBus interactions to explicitly use `org.freedesktop.systemd1`
interface and path. This ensures that the correct interfaces are used
and bypasses ".systemd1" magic from the library `pydbus`.
2025-04-22 10:59:59 +02:00
463a61a001 fix(dbus): Update DBus policy file path and interface name
Change the comment to reflect the new DBus policy file location. Adjust
the interface name to use `PiControl` instead of `picontrol` for
consistency.
2025-04-22 10:37:36 +02:00
2 changed files with 14 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
<!-- /etc/dbus-1/system.d/revpi-middleware.conf --> <!-- /usr/share/dbus-1/system.d/com.revolutionpi.middleware1.conf -->
<busconfig> <busconfig>
<!-- Allow full access to root as the bus owner --> <!-- Allow full access to root as the bus owner -->
<policy user="root"> <policy user="root">
@@ -12,7 +12,7 @@
<allow send_destination="com.revolutionpi.middleware1" <allow send_destination="com.revolutionpi.middleware1"
send_interface="org.freedesktop.DBus.Introspectable"/> send_interface="org.freedesktop.DBus.Introspectable"/>
<allow send_destination="com.revolutionpi.middleware1" <allow send_destination="com.revolutionpi.middleware1"
send_interface="com.revolutionpi.middleware1.picontrol"/> send_interface="com.revolutionpi.middleware1.PiControl"/>
</policy> </policy>
<!-- Standard-Policy --> <!-- Standard-Policy -->

View File

@@ -554,7 +554,11 @@ def configure_gui(action: ConfigActions):
return gui_available return gui_available
bus = SystemBus() bus = SystemBus()
systemd_manager = bus.get(".systemd1") systemd = bus.get(
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
)
systemd_manager = systemd["org.freedesktop.systemd1.Manager"]
if action is ConfigActions.ENABLE: if action is ConfigActions.ENABLE:
systemd_manager.SetDefaultTarget("graphical.target", True) systemd_manager.SetDefaultTarget("graphical.target", True)
@@ -654,7 +658,11 @@ def simple_systemd(action: ConfigActions, unit: str):
ValueError: If the specified action is not supported. ValueError: If the specified action is not supported.
""" """
bus = SystemBus() bus = SystemBus()
systemd_manager = bus.get(".systemd1") systemd = bus.get(
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
)
systemd_manager = systemd["org.freedesktop.systemd1.Manager"]
if action is ConfigActions.ENABLE: if action is ConfigActions.ENABLE:
systemd_manager.UnmaskUnitFiles([unit], False) systemd_manager.UnmaskUnitFiles([unit], False)
@@ -668,7 +676,7 @@ def simple_systemd(action: ConfigActions, unit: str):
elif action is ConfigActions.STATUS: elif action is ConfigActions.STATUS:
try: try:
unit_path = systemd_manager.LoadUnit(unit) unit_path = systemd_manager.LoadUnit(unit)
properties = bus.get(".systemd1", unit_path) properties = bus.get("org.freedesktop.systemd1", unit_path)
except Exception: except Exception:
log.warning(f"could not get systemd unit {unit}") log.warning(f"could not get systemd unit {unit}")
return False return False
@@ -678,7 +686,7 @@ def simple_systemd(action: ConfigActions, unit: str):
elif action is ConfigActions.AVAILABLE: elif action is ConfigActions.AVAILABLE:
try: try:
unit_path = systemd_manager.LoadUnit(unit) unit_path = systemd_manager.LoadUnit(unit)
properties = bus.get(".systemd1", unit_path) properties = bus.get("org.freedesktop.systemd1", unit_path)
except Exception: except Exception:
log.warning(f"could not get systemd unit {unit}") log.warning(f"could not get systemd unit {unit}")
return False return False