gitee.com/mysnapcore/mysnapd@v0.1.0/interfaces/builtin/alsa.go (about) 1 // -*- Mode: Go; indent-tabs-mode: t -*- 2 3 /* 4 * Copyright (C) 2016-2017 Canonical Ltd 5 * 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License version 3 as 8 * published by the Free Software Foundation. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * 18 */ 19 20 package builtin 21 22 const alsaSummary = `allows access to raw ALSA devices` 23 24 const alsaBaseDeclarationSlots = ` 25 alsa: 26 allow-installation: 27 slot-snap-type: 28 - core 29 deny-auto-connection: true 30 ` 31 32 const alsaConnectedPlugAppArmor = ` 33 # Description: Allow access to raw ALSA devices. 34 35 /dev/snd/ r, 36 /dev/snd/* rw, 37 38 /run/udev/data/c116:[0-9]* r, # alsa 39 /run/udev/data/+sound:card[0-9]* r, 40 41 # Allow access to the alsa state dir 42 /var/lib/alsa/{,*} r, 43 44 # Allow access to alsa /proc entries 45 @{PROC}/asound/ r, 46 @{PROC}/asound/** rw, 47 ` 48 49 var alsaConnectedPlugUDev = []string{ 50 `KERNEL=="controlC[0-9]*"`, 51 `KERNEL=="hwC[0-9]*D[0-9]*"`, 52 `KERNEL=="pcmC[0-9]*D[0-9]*[cp]"`, 53 `KERNEL=="midiC[0-9]*D[0-9]*"`, 54 `KERNEL=="timer"`, 55 `KERNEL=="seq"`, 56 `SUBSYSTEM=="sound", KERNEL=="card[0-9]*"`, 57 } 58 59 func init() { 60 registerIface(&commonInterface{ 61 name: "alsa", 62 summary: alsaSummary, 63 implicitOnCore: true, 64 implicitOnClassic: true, 65 baseDeclarationSlots: alsaBaseDeclarationSlots, 66 connectedPlugAppArmor: alsaConnectedPlugAppArmor, 67 connectedPlugUDev: alsaConnectedPlugUDev, 68 }) 69 }