From 941ea3ee688912e3e345adf9cd3ac59e108ab6e2 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Tue, 16 Feb 2021 09:34:15 +0100 Subject: [PATCH] Fix audio cgroup issue (#2575) --- supervisor/docker/audio.py | 13 +++++++++---- supervisor/hardware/policy.py | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/supervisor/docker/audio.py b/supervisor/docker/audio.py index 56fc68420..658d94ffb 100644 --- a/supervisor/docker/audio.py +++ b/supervisor/docker/audio.py @@ -1,6 +1,6 @@ """Audio docker object.""" import logging -from typing import Dict +from typing import Dict, List from ..const import ENV_TIME, MACHINE_ID from ..coresys import CoreSysAttributes @@ -41,6 +41,13 @@ class DockerAudio(DockerInterface, CoreSysAttributes): return volumes + @property + def cgroups_rules(self) -> List[str]: + """Return a list of needed cgroups permission.""" + return self.sys_hardware.policy.get_cgroups_rules( + PolicyGroup.AUDIO + ) + self.sys_hardware.policy.get_cgroups_rules(PolicyGroup.BLUETOOTH) + def _run(self) -> None: """Run Docker image. @@ -61,9 +68,7 @@ class DockerAudio(DockerInterface, CoreSysAttributes): name=self.name, hostname=self.name.replace("_", "-"), detach=True, - device_cgroup_rules=self.sys_hardware.policy.get_cgroups_rules( - PolicyGroup.AUDIO, PolicyGroup.BLUETOOTH - ), + device_cgroup_rules=self.cgroups_rules, environment={ENV_TIME: self.sys_config.timezone}, volumes=self.volumes, ) diff --git a/supervisor/hardware/policy.py b/supervisor/hardware/policy.py index c290cc6f6..7835f8efb 100644 --- a/supervisor/hardware/policy.py +++ b/supervisor/hardware/policy.py @@ -27,7 +27,7 @@ _CGROUPS: Dict[PolicyGroup, List[int]] = { 29, 81, 251, - 242, + 242, # vchiq (vchiq) 226 ], PolicyGroup.AUDIO: [