Commit Graph

54 Commits

Author SHA1 Message Date
555c781aed feat(dbus): Add InterfaceRevpiConfig to DBus interfaces list
Added the InterfaceRevpiConfig class to the list of DBus interfaces in
`bus_provider.py`. This ensures the new system configuration interface
is properly registered and accessible.
2025-04-21 10:21:36 +02:00
604cb61870 feat(dbus): Add Bluetooth configuration functionality
Introduce functionality to enable, disable, and check the status and
availability of Bluetooth devices using the `configure_bluetooth`
method. Integrate Bluetooth configuration into the feature management
system by mapping it in `interface_config.py`.
2025-04-21 10:17:56 +02:00
69e370f964 refactor(revpiconfig: Change Wi-Fi detection and rfkill index logic
Replaced inline rfkill index detection with a standalone
`get_rfkill_index` function for improved modularity. Removed
`_cm_with_wifi` and `_wlan_rfkill_index` attributes, utilizing
`_wlan_class_path` for Wi-Fi presence checks. Adjusted property and
output logic to incorporate the new function.
2025-04-21 10:05:20 +02:00
6eb7eeea40 feat(dbus): Add Wi-Fi configuration support to the system config
Introduces the `configure_wifi` function to handle Wi-Fi actions such as
enabling, disabling, and checking status. Updates the `ieee80211`
feature to use the new function, integrating Wi-Fi management into the
existing configuration framework.
2025-04-21 09:28:01 +02:00
18e6fb3d14 feat(revpiconfig): Enhance Wi-Fi detection and add rfkill index support
Improved logic to detect built-in and third-party Wi-Fi interfaces,
including integration of `rfkill` index retrieval for Wi-Fi devices.
This enhances support for various hardware setups and allows better
control over Wi-Fi functionality.
2025-04-21 09:05:47 +02:00
fe614d026a feat(dbus): Add support for configuring 'revpi-con-can' feature
Introduce the `configure_con_can` function to manage enabling,
disabling, status checking, and availability of the 'revpi-con-can'
feature. Update the `AVAILABLE_FEATURES` dictionary to integrate
'revpi-con-can' as a configurable feature.
2025-04-21 09:05:47 +02:00
870a55042e feat(dbus): Add support for configuring the external antenna
Introduce the `configure_external_antenna` function to manage external
antenna settings, including enable, disable, and status checks. Update
the feature configuration in `interface_config` to include this
functionality. This enhances WiFi-related configuration options.
2025-04-21 09:05:47 +02:00
2848fdcf54 feat(revpiconfig): Add ConfigTxt class for managing config.txt file
Introduced the ConfigTxt class to handle parsing, editing, and saving of
config.txt files. This includes methods for adding, clearing, and
retrieving configuration values, as well as handling dtoverlays and
dtparams. Enhanced system configuration capabilities by providing
structured support for config file operations.
2025-04-21 09:05:47 +02:00
d0f641f2b5 feat(dbus): Add dphys-swapfile configuration functionality
Implemented `configure_dphys_swapfile` to manage the dphys-swapfile
service, including automatic swapfile removal when the service is
disabled. Updated feature registry to support dphys-swapfile
configuration.
2025-04-21 09:05:47 +02:00
e8eba43647 feat(dbus): Add avahi-daemon configuration to system services
Introduce a `configure_avahi_daemon` function to manage the avahi-daemon
service and socket with proper post actions. Update the interface
configuration to enable avahi management using the new function.
2025-04-21 09:05:47 +02:00
0d601f623c feat(dbus): Remove 'var-log.mount' feature
The 'var-log.mount' feature was dropped and has been removed from
the AVAILABLE_FEATURES dictionary.
2025-04-21 09:05:47 +02:00
66735a9eba refactor(dbus): Move system configuration methods to revpi_config.py
Centralized `ConfigActions`, `configure_gui`, and `simple_systemd` into
`revpi_config.py` to eliminate duplication and improve maintainability.
Updated `interface_config.py` to import these methods, ensuring
consistent functionality across modules.
2025-04-21 09:05:47 +02:00
7525c9f653 feat(revpiconfig): Add RevPiConfig class for device information handling
This commit introduces a new `RevPiConfig` class to manage RevPi device
configuration details, such as model, serial, compute module type, WiFi,
and ConBridge detection. It parses CPU info from `/proc/cpuinfo` and
leverages helper methods for hardware-specific checks, enhancing the
middleware's ability to identify and manage hardware features.
2025-04-21 09:05:46 +02:00
3909fab379 feat(dbus): Add GUI configuration handling to interface_config.py
Introduced the `configure_gui` function to manage GUI enabling,
disabling, availability, and status retrieval. Updated the
`AVAILABLE_FEATURES` dictionary to include GUI management functionality,
leveraging systemd and os module operations.
2025-04-20 15:34:16 +02:00
9ce36c78e7 feat(dbus): Add D-Bus interface for system configuration in middleware
Introduced `InterfaceRevpiConfig` to manage feature actions like
enable/disable, status, and availability using D-Bus. Includes support
for predefined features with systemd integration and exception handling
for unsupported features.
2025-04-20 15:18:27 +02:00
c24c78761f fix(cli): Change absolute imports to relative imports 2025-04-20 15:12:09 +02:00
3cc64f514f feat(dbus): Add grep function to search for patterns in a file
The new `grep` function reads a specified file and returns lines
containing a given pattern. It handles file not found errors and logs
unexpected exceptions, improving resilience in file operations.
2025-04-20 15:11:43 +02:00
865d2ca7a9 refactor: Update interface name from 'picontrol' to 'PiControl'
Renamed all occurrences of 'picontrol' to 'PiControl' in the D-Bus
interface definitions, method calls, and test cases for consistency and
adherence to naming conventions. This ensures uniformity across the
codebase and resolves potential naming-related issues.
2025-04-20 12:19:41 +02:00
157b7bd118 test(dbus): Add support for testing driver reset notification
Introduce `FakeResetDriverWatchdog` to simulate driver reset triggers.
Update existing tests and add a new test, `test_notify_reset_driver`, to
verify reset notifications using the event signaling mechanism.
v0.0.2
2025-04-19 15:56:59 +02:00
26c3ac0afb refactor(dbus): D-Bus interface management with cleanup support.
Introduced a `DbusInterface` base class with a `cleanup` method to
standardize resource cleanup for D-Bus interfaces. Modified
`InterfacePiControl` to inherit from it and implemented `cleanup` logic
for proper watchdog resource handling. Adjusted `BusProvider` to manage
multiple interfaces and ensure cleanup on shutdown.
2025-04-19 15:55:49 +02:00
f8bc1532e3 refactor(dbus): Fix typo and remove unused thread instance
Corrected a typo in the `timeout` parameter name in `method_await_reset`
and removed an unused thread instance `th_sleep` from `dbus_helper.py`.
These changes improve code clarity and eliminate redundant components.
2025-04-19 15:05:47 +02:00
7207845b13 test(dbus): Add unit tests for PiControl D-Bus interface
Introduces initial tests for the PiControl interface in
`dbus_middleware1`. These tests cover basic functionality like checking
activity status and resetting the driver while verifying IOCTL calls.
2025-04-19 14:40:05 +02:00
3f808c55f8 test(dbus): Add unit test framework for dbus_middleware1 module
Introduces test infrastructure and mockup classes for
`dbus_middleware1`. Includes `BusProvider` test setup, fake device
implementations, and initialization logic to support session bus
testing. Enhances testability and isolation of the D-Bus middleware
components.
2025-04-19 14:40:05 +02:00
4ccc328d0b refactor(dbus): piControl driver reset with PiControlIoctl class
Replaces inline ioctl logic with the new `PiControlIoctl` class for
cleaner and reusable code. This improves readability, encapsulates
device operations, and simplifies error handling for resetting the
piControl driver.
2025-04-19 13:57:56 +02:00
76b53423c1 fix(dbus): Add error handling for DBus publishing and main loop
Wrap DBus publishing and main loop execution in try-except blocks to
capture and log failures. This ensures better visibility into errors and
prevents silent failures during runtime.
2025-04-19 12:43:22 +02:00
114cbd8099 refactor(cli): D-Bus helpers support session and system bus types
Introduced `BusType` enum to differentiate between session and system
bus usage in D-Bus calls. Updated `simple_call` and `await_signal`
functions to include a `bus_type` parameter, improving flexibility.
Adjusted `cli_picontrol` to leverage the new `BusType` parameter for
D-Bus interactions.
2025-04-19 12:24:37 +02:00
487d5b3d46 feat(dbus): Add running property to BusProvider
This property checks if the event loop is running, enhancing code
readability and convenience. It provides an easier way to monitor the
status of the loop, which may improve debugging and control flow
handling.
2025-04-19 12:13:45 +02:00
93b328bf3f feat(dbus): Add import for BusProvider in dbus_middleware1 module
This change includes the BusProvider import in the `__init__.py` file of
dbus_middleware1. It ensures the module has access to BusProvider
functionality, improving modularity and readiness for use.
2025-04-19 12:13:44 +02:00
bde3920fc1 feat: Add session bus option for local testing and development
Introduced a `--use-session-bus` flag to optionally use the D-Bus
session bus instead of the system bus. This allows better flexibility
for local testing and development scenarios without requiring
system-level changes. Updated related classes and functions to respect
the new flag.
2025-04-19 09:33:54 +02:00
a4ccb9081f 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.
2025-04-19 08:21:24 +02:00
4c1dc1c9b5 refactor(dbus): Move ResetDriverWatchdog to process_image_helper.py
The ResetDriverWatchdog class was relocated from dbus_helper.py to a new
helper module, process_image_helper.py, to improve code organization
and maintainability. Updated imports in relevant files to reflect this
change.
2025-04-19 08:13:02 +02:00
e756d68556 refactor(dbus): Move D-Bus helper functions to a dedicated file
Consolidated `REVPI_DBUS_*` constants and `extend_interface` function
into `dbus_helper.py` for better modularity and reusability. Updated
imports across modules to reflect this change.
2025-04-19 07:56:17 +02:00
96db211240 feat(cli): Add new CLI tool entry point for revpictl
This update introduces a new console script entry point for `revpictl`,
allowing users to execute CLI commands via `revpi_middleware
.cli_commands.cli_base:main`. It enhances functionality by providing
additional tooling for command-line interactions.
v0.0.1
2025-04-18 19:21:53 +02:00
de7abe3b9c chore(build): Update requirements for this project 2025-04-18 19:21:53 +02:00
e8c2482bea feat(cli): Add await-reset to wait for piControl reset signal
Introduced a new `await-reset` command to the CLI, allowing users to
wait for a `NotifyDriverReset` signal with an optional timeout
parameter. Updated the argument parser and implemented the signal
detection logic using `await_signal`. Ensures improved control and
monitoring of piControl driver resets via CLI.
2025-04-18 19:21:53 +02:00
527a921bfd feat(cli): Add await_signal function to handle D-Bus signals
Introduce the await_signal function to monitor D-Bus signals with a
timeout. This uses GLib's MainLoop and threading to wait for signals
efficiently while respecting a specified timeout duration.
2025-04-18 19:21:53 +02:00
6dca9880c8 feat(cli): Add D-Bus helper functions for CLI commands.
This introduces `simple_call`, a utility function to interact with D-Bus
interfaces within the RevPi system. It facilitates method invocation on
specific interfaces and paths, improving modularity and code reuse in
middleware operations.
2025-04-18 19:21:53 +02:00
06d33b218f feat: Add daemon mode and signal handling to main application
Introduced command line arguments for daemon mode and configuration file
support. Enhanced the application with signal handling for reload, log
rotation, and termination. Updated the main function for improved
structure and robustness.
2025-04-18 19:21:53 +02:00
964e0b997c feat: Add MiddlewareDaemon implementation to revpi-middleware
Introduce the main daemon class for revpi-middleware with methods for
initialization, configuration, DBus handling, and a mainloop. This
implementation includes support for configuration reloads, log rotation,
and proper thread management for DBus operations.
2025-04-18 19:21:53 +02:00
46a2b3f0ce feat(dbus): Add DBus policy configuration for revpi-middleware
Introduce a new DBus policy file to manage access control for
revpi-middleware. This configuration allows full access to the root
user, limited access for the 'picontrol' group, and denies unauthorized
access by default.
2025-04-18 19:21:53 +02:00
46f23a13d3 feat(dbus): Add extend_interface function for dynamic interface naming
This function constructs a fully qualified interface name by appending
segments to a predefined base name. It simplifies and standardizes the
process of generating extended interface names in the middleware.
2025-04-18 19:21:53 +02:00
b442369b42 feat(dbus): Add initial D-Bus middleware implementation
Introduce a D-Bus middleware module for revpi_middleware, including an
interface definition and a `BusProvider` class to handle D-Bus
communication. This forms the foundation for middleware interactions
using D-Bus.
2025-04-18 19:21:53 +02:00
11b68a0c15 feat(process_image): Add D-Bus interface for piControl driver
Introduced D-Bus interfaces in `process_image` to interact with the
piControl driver. Added `InterfacePiControl` class with methods to reset
the driver and signal driver reset events. This improves driver
management and integration via D-Bus.
2025-04-18 19:21:53 +02:00
91a1fae411 feat(dbus): Add ResetDriverWatchdog helper as global dbus helper
Introduced a new helper class `ResetDriverWatchdog`, a thread-based
watchdog to detect the `reset_driver` action. The implementation is
adapted from the revpipyload project and includes methods to
register/unregister callbacks and manage the watchdog lifecycle. This
addition improves monitoring capabilities for the process image.
2025-04-18 19:21:53 +02:00
049ddfdc0f chore: Update proginit to 1.4.0 2025-04-18 19:21:53 +02:00
Sven Sager
0380311a9d feat: Add systemd file and data to integrate the app as a daemon 2025-04-18 19:21:53 +02:00
Sven Sager
c1bd98c444 feat: Add dummy main application script
The script uses the logger system and prints an string. You can try
the programm call with and without `-vv`so see the differences of
logging levels.
2025-04-17 12:06:14 +02:00
Sven Sager
92666f117d build: Add all necessary files for the build system
All basic files for testing, building and distributing the project
are added here. The Makefile can set up the virtual environment and
create different package types from the project.
2025-04-17 12:06:14 +02:00
Sven Sager
8124a687f0 test: Add tests directory with a dummy test
For local and automated testing of the source code, the testing
folder is added. This includes all the tests that the module has to
go through. The project also uses pytest-cov, which can also create
coverage reports.
2025-04-17 12:06:14 +02:00
Sven Sager
2b36297afb feat: Add the data directory for additional data files for the project
The data directory will hold everything your projekt needs and more.
You can create SystemD unit files or other templates, which packagers
can use.
2025-04-17 12:06:14 +02:00