Skip to content

Fix Pipewire source/sink change detection (BugFix)#2693

Merged
Hook25 merged 6 commits into
mainfrom
fix-pw-insertion-detection
Jul 17, 2026
Merged

Fix Pipewire source/sink change detection (BugFix)#2693
Hook25 merged 6 commits into
mainfrom
fix-pw-insertion-detection

Conversation

@tomli380576

@tomli380576 tomli380576 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Description

The program used to check ["info"]["params"]["Route"] for each pipewire client but the more accurate way is to check ["info"]["params"]["EnumRoute"] because sometimes the Route list isn't updated upon device removal, but EnumRoute is.

Also added some type annotations and restrict monitor and through subcommands to only accept sinks/sources for the --mode param.

Resolved issues

On some desktops, GNOME will correctly report sink/source changes, but checkbox-support-pipewire-utils (and notably wpctl status) don't.

Documentation

This would align with how wireplumber detects insertion events.
https://github.com/PipeWire/wireplumber/blob/cb92ef9846e2b2f827e1831515bc3a31e7d2ed1a/src/scripts/device/select-routes.lua#L11

Why the test data was directly modified: EnumRoute and Route seem to share the exact same schema, just updated based on different events.

Tests

Unit tests

Regular laptop: https://certification.canonical.com/hardware/202503-36476/submission/500627/

The desktop in question: https://certification.canonical.com/hardware/202607-39073/submission/500626/

@tomli380576 tomli380576 changed the title Fix Pipewire source/sink change detection Fix Pipewire source/sink change detection (BugFix) Jul 16, 2026
@tomli380576
tomli380576 requested a review from Copilot July 16, 2026 02:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates checkbox-support’s PipeWire utility script to improve detection of audio sink/source changes by switching route detection from info.params.Route to info.params.EnumRoute, and tightens CLI argument validation to only accept sinks/sources for relevant subcommands.

Changes:

  • Switch active route inspection from Route to EnumRoute for device change detection and port enumeration.
  • Add/adjust type annotations and constrain monitor/through --mode values to sinks|sources.
  • Update unit tests to align with the new route key and mode values.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
checkbox-support/checkbox_support/scripts/pipewire_utils.py Use EnumRoute for change detection and restrict CLI --mode values for monitor/through.
checkbox-support/checkbox_support/scripts/tests/test_pipewire_utils.py Update fixtures and assertions to reflect EnumRoute usage and `sinks

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread checkbox-support/checkbox_support/scripts/pipewire_utils.py
Comment thread checkbox-support/checkbox_support/scripts/pipewire_utils.py
Comment thread checkbox-support/checkbox_support/scripts/pipewire_utils.py
Comment thread checkbox-support/checkbox_support/scripts/pipewire_utils.py
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 59.97%. Comparing base (7b6d08e) to head (106bbdf).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...support/checkbox_support/scripts/pipewire_utils.py 90.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2693   +/-   ##
=======================================
  Coverage   59.97%   59.97%           
=======================================
  Files         487      487           
  Lines       48920    48919    -1     
  Branches     8758     8757    -1     
=======================================
  Hits        29339    29339           
+ Misses      18658    18657    -1     
  Partials      923      923           
Flag Coverage Δ
checkbox-support 69.96% <90.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tomli380576
tomli380576 marked this pull request as ready for review July 16, 2026 07:32
@tomli380576

tomli380576 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

will upload submissions when C3 comes back submissions added

@Hook25 Hook25 self-assigned this Jul 17, 2026

@Hook25 Hook25 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

+1, thanks

@Hook25
Hook25 merged commit 2290358 into main Jul 17, 2026
41 checks passed
@Hook25
Hook25 deleted the fix-pw-insertion-detection branch July 17, 2026 07:13
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.

3 participants