Commit Graph

107 Commits

Author SHA1 Message Date
Sven Sager
710d7b2078 feat(io): Add GetByName and GetByPosition methods to DeviceManager
Introduced `GetByName` and `GetByPosition` methods in the D-Bus
interface and implementation for retrieving device object paths by name
or position. Updated `GetAllDevices` return type to `ao`.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-04 15:20:34 +01:00
Sven Sager
8ee5e0836f feat(io): Add position property to InterfaceDevice
Introduced a new `position` property with read access in the D-Bus
interface and implemented its corresponding method.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-04 15:20:34 +01:00
Sven Sager
6f1bd7f7ea refactor(io): Rename IO event methods to signal methods for clarity
Renamed `ActivateIoEvents` to `ActivateIoSignals` and
`DeactivateIoEvents` to `DeactivateIoSignals` in both the D-Bus
interface and implementation to better align with D-Bus signal
semantics.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-04 15:20:34 +01:00
Sven Sager
785569c86b fix(io): Do not read/wirte process image while device is in self-update
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-04 15:20:34 +01:00
Sven Sager
415e8502f7 fix(io): Handle large integer values with fallback to raw byte arrays
Added a fallback mechanism to handle cases where integer values exceed
valid range by using raw byte arrays (`ay`). Updated D-Bus methods and
properties to support this behavior.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-04 15:20:34 +01:00
Sven Sager
b16331cf84 feat(io): Add bitaddress property to IO interfaces
Introduced the `bitaddress` property with read-write access to `Input`
and `Output` D-Bus interfaces. Implemented corresponding property
methods.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-04 15:20:34 +01:00
Sven Sager
a2d1531e77 feat(io): Simplify IO interface hierarchy and unify property handling
Replaced specific IO interface classes (`InterfaceInpBool`,
`InterfaceInpInt`, etc.) with generic `InterfaceInput` and
`InterfaceOutput` classes to simplify the hierarchy.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-04 15:20:34 +01:00
Sven Sager
bbbbd3e0e1 fix(io): Add argument names to D-Bus methods for input/output paths
Updated `GetAllInputs` and `GetAllOutputs` methods in the D-Bus
interface to include explicit argument names (`object-path-list`) and
adjusted their types to `ao` not strings.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-03 08:54:56 +01:00
Sven Sager
a43fc764c6 doc: Add D-Bus data types documentation
Added a new `docs/dbus.md` file with an overview of standardized D-Bus
data types and their signatures. Updated `README.md` with a reference to
the documentation.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-03 08:03:37 +01:00
Sven Sager
0716169a03 feat(io): Add min_value and max_value properties to IOs
Added `min_value` and `max_value` properties to integer IOs for
determining value ranges. Updated D-Bus interface with corresponding
properties.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-03 08:03:37 +01:00
Sven Sager
77a3fbb16c feat(io): Add inp and out properties to InterfaceDeviceManager
Added `inp` and `out` properties for accessing input and output paths in
`InterfaceDeviceManager`. Updated D-Bus interface with corresponding
properties.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-02 17:06:34 +01:00
Sven Sager
037e9c05ac style(io): Reformatted with black
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-02 17:06:34 +01:00
Sven Sager
66c8c9851b refactor(io): Replace _get_io_path method with get_io_path utility
The `_get_io_path` method was removed from `InterfaceIoManager` and
replaced with the `get_io_path` utility function from `ios1_helper.py`
to reduce redundancy and improve code reusability.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-02 17:06:34 +01:00
Sven Sager
afdae78336 feat(io): Add new IO properties and corresponding methods
Added `address`, `byteorder`, and `length` properties to D-Bus
interfaces for IOs. Implemented corresponding property methods in
`ios1_helper.py`.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-02 17:06:33 +01:00
Sven Sager
4dd4c814b5 fix(io): Add property methods on integer IOs
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-01-30 13:26:21 +01:00
Sven Sager
b8b99ed3b0 feat(io): Add InterfaceDevice class for device handling via D-Bus
Introduced the `InterfaceDevice` class, enabling detailed device
property access through D-Bus. Updated `bus_provider_io` to include
device interfaces in the D-Bus provider.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-01-30 13:06:15 +01:00
Sven Sager
b68f1ffb36 feat(io): Add InterfaceDeviceManager to D-Bus bus provider
Integrated the InterfaceDeviceManager class into the com.revolutionpi
.ios1 D-Bus bus provider. This addition enables managing device paths
and querying all devices via D-Bus.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-01-30 12:29:08 +01:00
Marc Kittner
ffd04a0410 fix: Use variant_type instead of hard coded boolean
Signed-off-by: Marc Kittner <m.kittner@kunbus.com>
2026-01-30 11:26:15 +01:00
Sven Sager
549cddf594 feat(io): Integrate com.revolutionpi.ios1 bus to daemon
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-01-16 14:27:41 +01:00
Sven Sager
f56db7ab1c doc(io): Add IO example program
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-01-16 14:27:41 +01:00
Sven Sager
208b391aa9 feat(io): Add dbus policy for com.revolutionpi.ios1 bus
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-01-16 14:27:41 +01:00
Sven Sager
917ab7ab1f feat(io): Add dbus bus com.revolutionpi.ios1
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-01-16 14:27:41 +01:00
Sven Sager
b4f817b477 feat(examples): Add revpi-config CLI tool for RevPi configuration
Introduced a new Python-based command-line tool `revpi-config` to manage
Revolution Pi features via D-Bus. The tool supports enabling,
disabling, checking status, and availability for various features.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2025-06-04 08:10:52 +02:00
Sven Sager
66046b6a9d feat(dbus): Update systemd unit state check to include 'activating'
Previously, the check only considered 'active' as a valid ActiveState.
This update ensures the system also accounts for units in the
'activating' state, improving compatibility with transitional states in
systemd services.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2025-05-27 14:54:44 +02:00
Sven Sager
9ec1e04d2b feat(dbus): Update service key for systemd-timesyncd to 'ntp'
Renamed the key 'systemd-timesyncd' to 'ntp' in the services mapping.
This improves naming consistency and aligns it with the expected service
identifier. No functional changes were introduced.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2025-05-27 14:54:14 +02:00
Sven Sager
1cb1062138 feat(dbus): Update feature key from 'dphys-swapfile' to 'swapfile'
Renamed the feature key for swapfile configuration to ensure consistency
and simplify naming.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2025-05-27 14:28:07 +02:00
Sven Sager
8d01eee66d feat(dbus): Update status change notification in feature toggle methods
Added calls to `StatusChanged` in `Disable` and `Enable` methods to
notify when a feature's state is updated. This ensures proper tracking
and external communication of feature status changes.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2025-05-27 14:28:07 +02:00
Sven Sager
40059d6068 feat(dbus): Add InterfaceSoftwareServices to bus provider initialization
This change integrates the InterfaceSoftwareServices class into the list
of interfaces initialized by the bus provider. It ensures the new
interface is properly registered and available for use, improving
system functionality and extensibility.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2025-05-27 14:18:37 +02:00
Sven Sager
50789853e9 feat(dbus): Add D-Bus interface for managing software services
Introduce `InterfaceSoftwareServices` to handle service enable/disable
actions, status, and availability via D-Bus. Consolidate `avahi` service
configuration into the new interface by removing redundant logic from
`revpi_config.py`.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2025-05-27 14:18:37 +02:00
Sven Sager
d2e2f1c7f3 refactor(dbus): Move simple_systemd to systemd_helper
Moved the `simple_systemd` function to a dedicated `systemd_helper`
module to improve code organization and reusability. Updated imports
accordingly in affected files.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2025-05-27 14:18:37 +02:00
Sven Sager
32574e0815 refactor: DBus interface includes bus instance
Updated `InterfaceRevpiConfig` to require a bus parameter, ensuring
proper initialization. Introduced a constructor in `DbusInterface` to
store the bus instance.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2025-05-27 12:37:15 +02:00
Sven Sager
a29979ad78 feat(dbus): Add AvailabilityChanged signal to .RevpiConfig
This signal provides a mechanism for notifying changes in availability
status. It will complement the existing `StatusChanged` signal and
enhance the system's event-handling capabilities.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2025-05-27 07:58:40 +02:00
Sven Sager
431f9308de feat(dbus): Add StatusChanged DBus signal to interface configuration
Introduced the `StatusChanged` signal in `.RevpiConfig` interface to
notify changes in feature status. Emitting this signal in `Enable` and
`Disable` methods ensures real-time updates for feature state changes.
This enhances communication and monitoring within the DBus middleware.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2025-05-26 15:21:08 +02:00
Sven Sager
dc2d1ab3a0 ci: Test in a bookworm container
In order to be able to provide all functions of the DBus during testing,
the CI uses the Python 3.11 version in a Bookworm container for
testing. This is the version that is pre-installed in Debian Bookworm.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2025-05-23 09:54:30 +02:00
Sven Sager
983c6cefea ci: Start dbus session bus for testing
A dbus session bus must be started for testing. The command
`dbus-run-session` creates a session for the following command. As a
result, `pytest` runs with its own session bus for the tests.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2025-05-23 09:54:30 +02:00
Sven Sager
a977884e17 ci: Set machine-id for dbus
Systemd does not exist in the docker file. So we just set an machine-id,
which the dbus-daemon can use to start a session.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2025-05-23 09:54:30 +02:00
Sven Sager
20fb85a3f0 ci: Install system dependencies for testing
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2025-05-23 09:52:43 +02:00
Sven Sager
f4efb1daae fix: Add missing reuse license information
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2025-05-23 09:36:41 +02:00
Sven Sager
fb181f8810 ci: Add Revolution Pi pipelines
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2025-05-22 13:14:22 +02:00
Sven Sager
3dee7784e2 ci: Add GitLab python pipelines
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2025-05-22 13:14:22 +02:00
cc560770ce feat(revpiconfig): Make unit config changes asynchronous
Refactored unit enable/disable actions to run in separate threads,
ensuring non-blocking operations. This enhances performance and avoids
potential delays during systemd operations.
v0.0.5
2025-04-22 13:42:33 +02:00
4df903783c fix(revpiconfig): Ensure systemd reloads after unit changes
Added systemd reload calls after unit enable/disable to reflect changes.
Adjusted DBus method calls to capture and utilize change outputs
effectively. This improves reliability in applying unit modifications.
2025-04-22 12:35:43 +02:00
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.
v0.0.4
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
1fab228272 refactor: Rename WiFi to WLAN for consistent terminology
Updated variable names, function names, and comments to replace "WiFi"
with "WLAN" throughout the codebase. This ensures alignment with
standardized terminology and improves clarity in functionality and
configuration handling. Adjusted related configurations and interface
mappings accordingly.
v0.0.3
2025-04-21 13:34:10 +02:00
fc82ec0eb9 feat(revpiconfig): Replace rfkill subprocess calls with sysfs writes
Updated Bluetooth and WiFi rfkill handling by replacing subprocess calls
to "rfkill" with direct writes to sysfs files. This change simplifies
the implementation and improves performance by avoiding external
command execution.
2025-04-21 13:25:56 +02:00