Clean up daemon and improve readability - #101
Merged
Merged
Conversation
…ke future prettier
There was a problem hiding this comment.
Pull request overview
This PR refactors the cardwire daemon to improve readability by consolidating shared daemon state into a DaemonInner, splitting pre_daemon_tasks() into smaller helpers, and turning several background tasks into DaemonManager-provided futures. It also adjusts PCI/GPU monitoring and default-GPU selection to operate on the current GpuInterface map.
Changes:
- Refactor daemon state management (
DaemonInner) and reorganize startup tasks into focused helper methods. - Rework PCI udev monitoring to trigger GPU refresh via the in-process
DebugInterfacerather than a zbus proxy. - Update default-GPU detection (
check_default_drm_class) to operate onGpuInterfaceentries and apply it after refreshes.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/cardwire-daemon/src/tasks/monitor_udev.rs | Switch PCI monitoring to use DebugInterface for refreshing GPUs. |
| crates/cardwire-daemon/src/models.rs | Introduce DaemonInner, refactor startup logic, and add task-future helpers. |
| crates/cardwire-daemon/src/interface/debug.rs | Adjust GPU refresh flow and default-GPU detection after rebuilding interfaces. |
| crates/cardwire-daemon/src/daemon.rs | Update main to spawn task futures from DaemonManager and align with refactor. |
| crates/cardwire-daemon/src/core/gpu/discover.rs | Change default-GPU detection to work with GpuInterface instead of GpuDevice. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
luytan
marked this pull request as draft
July 26, 2026 17:28
luytan
marked this pull request as ready for review
July 26, 2026 19:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Please include a summary of the changes and if applicable, a related issue.
If this PR introduce a new feature, explain your motivations
Fixes # (issue)
TODO
Checklist: