Fix Pipewire source/sink change detection (BugFix)#2693
Conversation
There was a problem hiding this comment.
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
RoutetoEnumRoutefor device change detection and port enumeration. - Add/adjust type annotations and constrain
monitor/through--modevalues tosinks|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.
Codecov Report❌ Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
|
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 theRoutelist isn't updated upon device removal, but EnumRoute is.Also added some type annotations and restrict
monitorandthroughsubcommands to only acceptsinks/sourcesfor the--modeparam.Resolved issues
On some desktops, GNOME will correctly report sink/source changes, but
checkbox-support-pipewire-utils(and notablywpctl 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/