Skip to content

i/hdmi-cec: add a new hdmi-cec interface - #17726

Merged
bboozzoo merged 3 commits into
canonical:masterfrom
saviq-work:MIRENG-2199-hdmi-cec-interface
Oct 15, 2026
Merged

bboozzoo merged 3 commits into
canonical:masterfrom
saviq-work:MIRENG-2199-hdmi-cec-interface

Conversation

@saviq-work

@saviq-work saviq-work commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

The device list comes from an analysis of the different adapter code in https://github.com/Pulse-Eight/libcec/tree/master/src/libcec/adapter.

@saviq-work

Copy link
Copy Markdown
Contributor Author

Corresponding documentation: canonical/snap-docs#606

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Thu Oct 15 18:37:09 UTC 2026
The following results are from: https://github.com/canonical/snapd/actions/runs/38700759149

Test Predictor Analysis

Executing

Test Success %
openstack-arm:ubuntu-24.04-arm-64:tests/main/interfaces-system-observe 🟢 85.9%

Skipped tests from snapd-testing-skip

If you wish to have any of the below tests run in your PR, in your PR description, add 'unskip:' followed by a copy-and-pasted list of the below tests you wish to run (unskip plus test list must be valid yaml)

  • garden:fedora-44-64:tests/main/network-retry
  • garden:ubuntu-24.04-64:tests/main/apparmor-prompting-support
  • garden:ubuntu-24.04-64:tests/main/auto-refresh-retry
  • garden:ubuntu-24.04-64:tests/main/network-retry
  • garden:ubuntu-26.04-64:tests/main/apparmor-prompting-support
  • garden:ubuntu-26.04-64:tests/main/auto-refresh-retry
  • garden:ubuntu-26.04-64:tests/main/network-retry
  • openstack-arm:ubuntu-24.04-arm-64:tests/main/i18n
  • openstack-arm:ubuntu-24.04-arm-64:tests/main/lxd
  • openstack-arm:ubuntu-core-24-arm-64:tests/main/i18n
  • openstack-arm:ubuntu-core-24-arm-64:tests/main/lxd
  • openstack:debian-sid-64:tests/main/interfaces-network-status-classic
  • openstack:debian-sid-64:tests/main/interfaces-xdg-portal-permission-store
  • openstack:fedora-44-64:tests/main/network-retry
  • openstack:opensuse-16.0-64:tests/main/interfaces-packagekit-control
  • openstack:opensuse-tumbleweed-64:tests/main/interfaces-packagekit-control
  • openstack:opensuse-tumbleweed-selinux-64:tests/main/interfaces-packagekit-control
  • openstack:ubuntu-16.04-64:tests/main/lxd
  • openstack:ubuntu-18.04-64:tests/main/lxd
  • openstack:ubuntu-20.04-64:tests/main/lxd
  • openstack:ubuntu-22.04-64:tests/main/lxd
  • openstack:ubuntu-24.04-64:tests/main/apparmor-prompting-flag-restart
  • openstack:ubuntu-24.04-64:tests/main/apparmor-prompting-integration-tests
  • openstack:ubuntu-24.04-64:tests/main/apparmor-prompting-prompt-restoration
  • openstack:ubuntu-24.04-64:tests/main/apparmor-prompting-smoke
  • openstack:ubuntu-24.04-64:tests/main/apparmor-prompting-snapd-startup
  • openstack:ubuntu-24.04-64:tests/main/apparmor-prompting-support
  • openstack:ubuntu-24.04-64:tests/main/auto-refresh-retry
  • openstack:ubuntu-24.04-64:tests/main/i18n
  • openstack:ubuntu-24.04-64:tests/main/interfaces-requests-activates-handlers
  • openstack:ubuntu-24.04-64:tests/main/lxd
  • openstack:ubuntu-24.04-64:tests/main/network-retry
  • openstack:ubuntu-26.04-64:tests/main/apparmor-prompting-flag-restart
  • openstack:ubuntu-26.04-64:tests/main/apparmor-prompting-integration-tests
  • openstack:ubuntu-26.04-64:tests/main/apparmor-prompting-prompt-restoration
  • openstack:ubuntu-26.04-64:tests/main/apparmor-prompting-smoke
  • openstack:ubuntu-26.04-64:tests/main/apparmor-prompting-snapd-startup
  • openstack:ubuntu-26.04-64:tests/main/apparmor-prompting-support
  • openstack:ubuntu-26.04-64:tests/main/auto-refresh-retry
  • openstack:ubuntu-26.04-64:tests/main/i18n
  • openstack:ubuntu-26.04-64:tests/main/interfaces-requests-activates-handlers
  • openstack:ubuntu-26.04-64:tests/main/lxd
  • openstack:ubuntu-26.04-64:tests/main/network-retry
  • openstack:ubuntu-26.10-64:tests/main/apparmor-prompting-flag-restart
  • openstack:ubuntu-26.10-64:tests/main/apparmor-prompting-integration-tests
  • openstack:ubuntu-26.10-64:tests/main/apparmor-prompting-prompt-restoration
  • openstack:ubuntu-26.10-64:tests/main/apparmor-prompting-smoke
  • openstack:ubuntu-26.10-64:tests/main/apparmor-prompting-snapd-startup
  • openstack:ubuntu-26.10-64:tests/main/apparmor-prompting-support
  • openstack:ubuntu-26.10-64:tests/main/interfaces-requests-activates-handlers
  • openstack:ubuntu-26.10-64:tests/main/lxd
  • openstack:ubuntu-core-18-64:tests/main/lxd
  • openstack:ubuntu-core-20-64:tests/main/lxd
  • openstack:ubuntu-core-22-64:tests/main/lxd
  • openstack:ubuntu-core-24-64:tests/main/lxd
  • openstack:ubuntu-core-26-64:tests/main/lxd

@saviq-work
saviq-work force-pushed the MIRENG-2199-hdmi-cec-interface branch 2 times, most recently from 20b0539 to 98cd432 Compare September 28, 2026 16:14
@codecov

codecov Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.26%. Comparing base (485d704) to head (fc421d9).
⚠️ Report is 77 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #17726      +/-   ##
==========================================
+ Coverage   77.93%   82.26%   +4.32%     
==========================================
  Files        1406     1420      +14     
  Lines      200507   202694    +2187     
  Branches     2503     2626     +123     
==========================================
+ Hits       156275   166738   +10463     
+ Misses      34866    33836    -1030     
+ Partials     9366     2120    -7246     
Flag Coverage Δ
unittests 82.26% <100.00%> (+4.32%) ⬆️

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.

@saviq-work
saviq-work force-pushed the MIRENG-2199-hdmi-cec-interface branch from 98cd432 to 150de6b Compare September 29, 2026 09:40
Comment thread interfaces/builtin/hdmi_cec.go
@bboozzoo
bboozzoo requested review from Meulengracht and jslarraz and a balanced review from Copilot October 5, 2026 10:05
@bboozzoo bboozzoo added the Needs security review Can only be merged once security gave a :+1: label Oct 5, 2026
@bboozzoo bboozzoo added this to the 2.79 milestone Oct 5, 2026

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.

Copilot review overview

🟡 Changes recommended

Pulse-Eight USB adapters remain unsupported, and /dev/vchiq is omitted from device-cgroup tagging.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds an hdmi-cec built-in interface for confined access to HDMI-CEC adapters.

Changes:

  • Defines AppArmor, udev, and base-declaration policy.
  • Adds interface unit tests.
  • Adds a policy-test consumer application.
File Description
interfaces/​builtin/​hdmi_cec.go Implements the interface policy.
interfaces/​builtin/​hdmi_cec_test.go Tests registration and generated policy.
tests/​lib/​snaps/​test-snapd-policy-app-consumer/​meta/​snap.yaml Adds the interface to policy integration testing.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread interfaces/builtin/hdmi_cec.go

@bboozzoo bboozzoo 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.

LGTM


func init() {
registerIface(&commonInterface{
name: "hdmi-cec",

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.

@pedronis have a look at the naming here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah I was considering hdmi-cec-control, but there can't be an observe to match it…

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.

🟡 Changes recommended

The VCHIQ grant crosses hardware boundaries and, if retained, lacks required device-cgroup tagging.

1 open finding
1 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity udev allowlist omits vchiq device rule

interfaces/​builtin/​hdmi_cec.go:59

If the /dev/vchiq route is retained after resolving its shared-device implications, this udev allowlist also needs KERNEL=="vchiq". Without that tag, strict snaps do not get the node in their device cgroup, so the Raspberry Pi/libCEC path remains unusable despite the AppArmor grant. Add the rule and cover it in TestUDevSpec, as the camera and opengl interfaces do.

🧠 Review effort: Balanced

Comment thread interfaces/builtin/hdmi_cec.go Outdated

@Meulengracht Meulengracht left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thank you, still needs a +1 from @jslarraz

@github-actions github-actions Bot added the Auto rerun spread Auto reruns spread up to 4 times in non-draft PRs w/ >=1 approval and <20 fails in any fund. system label Oct 13, 2026

@jslarraz jslarraz 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.

Added some questions / requests around /dev/vchiq rw,

Comment thread interfaces/builtin/hdmi_cec.go Outdated
These give too broad access to the VideoCore subsystem, and is not
needed for modern CEC support on the Raspberry Pi, handled through
standard `/dev/cecX` nodes.

@jslarraz jslarraz 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.

Thanks, LGTM now

@jslarraz jslarraz removed the Needs security review Can only be merged once security gave a :+1: label Oct 13, 2026
@saviq-work

Copy link
Copy Markdown
Contributor Author

Don't think I caused either of these?

FAIL	github.com/snapcore/snapd/daemon	91.917s
Some of the repositories have not been refreshed because of an error.

@bboozzoo bboozzoo self-assigned this Oct 14, 2026
@bboozzoo

Copy link
Copy Markdown
Contributor

Don't think I caused either of these?

FAIL	github.com/snapcore/snapd/daemon	91.917s
Some of the repositories have not been refreshed because of an error.

Yes, likely unrelated. The PR has sufficient number of approvals, I'll try to get it landed

@bboozzoo bboozzoo closed this Oct 15, 2026
@bboozzoo bboozzoo reopened this Oct 15, 2026
@bboozzoo
bboozzoo merged commit e6b1a1f into canonical:master Oct 15, 2026
1069 of 1103 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto rerun spread Auto reruns spread up to 4 times in non-draft PRs w/ >=1 approval and <20 fails in any fund. system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants