Skip to content

Clean up daemon and improve readability - #101

Merged
luytan merged 5 commits into
mainfrom
improve-daemon-startup
Jul 26, 2026
Merged

Clean up daemon and improve readability#101
luytan merged 5 commits into
mainfrom
improve-daemon-startup

Conversation

@luytan

@luytan luytan commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

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

  • Copy-Paste this line

Checklist:

  • My code follows the style guidelines of this project (cargo fmt)
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the mdBook documentation
  • My changes generate no new warnings (clippy/clang)
  • New and existing unit tests pass locally with my changes (either use nix flake check or wait for the ci)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 DebugInterface rather than a zbus proxy.
  • Update default-GPU detection (check_default_drm_class) to operate on GpuInterface entries 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.

Comment thread crates/cardwire-daemon/src/tasks/monitor_udev.rs
Comment thread crates/cardwire-daemon/src/models.rs Outdated
Comment thread crates/cardwire-daemon/src/models.rs
Comment thread crates/cardwire-daemon/src/models.rs Outdated
@luytan
luytan marked this pull request as draft July 26, 2026 17:28
@luytan
luytan marked this pull request as ready for review July 26, 2026 19:07
@luytan luytan self-assigned this Jul 26, 2026
@luytan
luytan merged commit c0a2d60 into main Jul 26, 2026
6 checks passed
@luytan
luytan deleted the improve-daemon-startup branch July 26, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants