diff options
author | Joshua Lock <josh@linux.intel.com> | 2012-01-02 18:17:56 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-01-17 14:53:24 +0000 |
commit | c86797abdfc6db4b22710cca7924396c16eb6fc0 (patch) | |
tree | da484ee0a7e8e723cc84419d2b21935b18bdbd69 | |
parent | 79b6192d21bc553603a6f94f5e0bbaf55f22c2c4 (diff) | |
download | poky-c86797abdfc6db4b22710cca7924396c16eb6fc0.tar.gz |
alsa-state: add alsa-state from oe classic
alsa-state adds an init script and configuration files to enable a
consistent and centralised mechanism for setting and restoring alsa
configuration.
(From OE-Core rev: 8bc43c40cf72d5543924229146fa4106ad87b147)
Signed-off-by: Joshua Lock <josh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-bsp/alsa-state/alsa-state.bb | 57 | ||||
-rwxr-xr-x | meta/recipes-bsp/alsa-state/alsa-state/alsa-state | 29 | ||||
-rw-r--r-- | meta/recipes-bsp/alsa-state/alsa-state/asound.conf | 12 | ||||
-rw-r--r-- | meta/recipes-bsp/alsa-state/alsa-state/asound.state | 1 |
4 files changed, 99 insertions, 0 deletions
diff --git a/meta/recipes-bsp/alsa-state/alsa-state.bb b/meta/recipes-bsp/alsa-state/alsa-state.bb new file mode 100644 index 0000000000..ecfa97530f --- /dev/null +++ b/meta/recipes-bsp/alsa-state/alsa-state.bb | |||
@@ -0,0 +1,57 @@ | |||
1 | # Copyright Matthias Hentges <devel@hentges.net> (c) 2007 | ||
2 | # License: MIT (see http://www.opensource.org/licenses/mit-license.php | ||
3 | # for a copy of the license) | ||
4 | # | ||
5 | # Filename: alsa-state.bb | ||
6 | |||
7 | SUMMARY = "Alsa scenario files to enable alsa state restoration." | ||
8 | DESCRIPTION = "Alsa Scenario Files - an init script and state files to restore \ | ||
9 | sound state at system boot and save it at system shut down." | ||
10 | LICENSE = "MIT" | ||
11 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" | ||
12 | PV = "0.2.0" | ||
13 | PR = "r0" | ||
14 | |||
15 | SRC_URI = "\ | ||
16 | file://asound.conf \ | ||
17 | file://asound.state \ | ||
18 | file://alsa-state \ | ||
19 | " | ||
20 | |||
21 | RDEPENDS = "alsa-utils-alsactl" | ||
22 | |||
23 | inherit update-rc.d | ||
24 | |||
25 | INITSCRIPT_NAME = "alsa-state" | ||
26 | INITSCRIPT_PARAMS = "start 39 S . stop 31 0 6 ." | ||
27 | |||
28 | do_install() { | ||
29 | install -d ${D}${sysconfdir}/init.d | ||
30 | install -m 0755 ${WORKDIR}/alsa-state ${D}${sysconfdir}/init.d | ||
31 | |||
32 | install -m 0644 ${WORKDIR}/asound.conf ${D}${sysconfdir} | ||
33 | install -m 0644 ${WORKDIR}/*.state ${D}${sysconfdir} | ||
34 | } | ||
35 | |||
36 | PACKAGES += "alsa-states" | ||
37 | |||
38 | RRECOMMENDS_alsa-state = "alsa-states" | ||
39 | |||
40 | FILES_${PN} = "${sysconfdir}/init.d ${sysconfdir}/asound.conf" | ||
41 | CONFFILES_${PN} = "${sysconfdir}/asound.conf" | ||
42 | |||
43 | FILES_alsa-states = "${sysconfdir}/*.state" | ||
44 | |||
45 | pkg_postinst_${PN}() { | ||
46 | if test -z "$D" | ||
47 | then | ||
48 | if test -x /usr/sbin/alsactl | ||
49 | then | ||
50 | /usr/sbin/alsactl -f ${sysconfdir}/asound.state restore | ||
51 | fi | ||
52 | # INITSCRIPT_PARAMS changed, so remove the old and | ||
53 | # install the new setting. | ||
54 | update-rc.d -f ${INITSCRIPT_NAME} remove | ||
55 | update-rc.d ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS} | ||
56 | fi | ||
57 | } | ||
diff --git a/meta/recipes-bsp/alsa-state/alsa-state/alsa-state b/meta/recipes-bsp/alsa-state/alsa-state/alsa-state new file mode 100755 index 0000000000..84cdf03750 --- /dev/null +++ b/meta/recipes-bsp/alsa-state/alsa-state/alsa-state | |||
@@ -0,0 +1,29 @@ | |||
1 | #! /bin/sh | ||
2 | # | ||
3 | # Copyright Matthias Hentges <devel@hentges.net> (c) 2007 | ||
4 | # License: GPL (see http://www.gnu.org/licenses/gpl.txt for a copy of the license) | ||
5 | # | ||
6 | # Filename: alsa-state | ||
7 | # Date: 20070308 (YMD) | ||
8 | |||
9 | |||
10 | asound_restore(){ | ||
11 | echo "ALSA: Restoring mixer settings..." | ||
12 | if test -x /usr/sbin/alsactl -a -e /etc/asound.state | ||
13 | then | ||
14 | /usr/sbin/alsactl -f /etc/asound.state restore & | ||
15 | fi | ||
16 | } | ||
17 | |||
18 | asound_store(){ | ||
19 | echo "ALSA: Storing mixer settings..." | ||
20 | if test -x /usr/sbin/alsactl | ||
21 | then | ||
22 | /usr/sbin/alsactl -f /etc/asound.state store | ||
23 | fi | ||
24 | } | ||
25 | |||
26 | case "$1" in | ||
27 | start) asound_restore ;; | ||
28 | stop) asound_store ;; | ||
29 | esac | ||
diff --git a/meta/recipes-bsp/alsa-state/alsa-state/asound.conf b/meta/recipes-bsp/alsa-state/alsa-state/asound.conf new file mode 100644 index 0000000000..6be024201c --- /dev/null +++ b/meta/recipes-bsp/alsa-state/alsa-state/asound.conf | |||
@@ -0,0 +1,12 @@ | |||
1 | # default dmix configuration | ||
2 | |||
3 | pcm.!default { | ||
4 | type plug | ||
5 | slave.pcm "dmix" | ||
6 | } | ||
7 | |||
8 | ctl.mixer0 { | ||
9 | type hw | ||
10 | card 0 | ||
11 | } | ||
12 | |||
diff --git a/meta/recipes-bsp/alsa-state/alsa-state/asound.state b/meta/recipes-bsp/alsa-state/alsa-state/asound.state new file mode 100644 index 0000000000..ddd1cce85d --- /dev/null +++ b/meta/recipes-bsp/alsa-state/alsa-state/asound.state | |||
@@ -0,0 +1 @@ | |||
# Dummy file, do not delete | |||