diff options
| author | Tudor Florea <tudor.florea@enea.com> | 2015-10-09 22:59:03 +0200 |
|---|---|---|
| committer | Tudor Florea <tudor.florea@enea.com> | 2015-10-09 22:59:03 +0200 |
| commit | 972dcfcdbfe75dcfeb777150c136576cf1a71e99 (patch) | |
| tree | 97a61cd7e293d7ae9d56ef7ed0f81253365bb026 /meta/recipes-bsp/alsa-state | |
| download | poky-972dcfcdbfe75dcfeb777150c136576cf1a71e99.tar.gz | |
initial commit for Enea Linux 5.0 arm
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta/recipes-bsp/alsa-state')
| -rw-r--r-- | meta/recipes-bsp/alsa-state/alsa-state.bb | 65 | ||||
| -rwxr-xr-x | meta/recipes-bsp/alsa-state/alsa-state/alsa-state-init | 39 | ||||
| -rw-r--r-- | meta/recipes-bsp/alsa-state/alsa-state/asound.conf | 1 | ||||
| -rw-r--r-- | meta/recipes-bsp/alsa-state/alsa-state/asound.state | 1 |
4 files changed, 106 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..17c2d002d5 --- /dev/null +++ b/meta/recipes-bsp/alsa-state/alsa-state.bb | |||
| @@ -0,0 +1,65 @@ | |||
| 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 = "r5" | ||
| 14 | |||
| 15 | SRC_URI = "\ | ||
| 16 | file://asound.conf \ | ||
| 17 | file://asound.state \ | ||
| 18 | file://alsa-state-init \ | ||
| 19 | " | ||
| 20 | |||
| 21 | # As the recipe doesn't inherit systemd.bbclass, we need to set this variable | ||
| 22 | # manually to avoid unnecessary postinst/preinst generated. | ||
| 23 | python __anonymous() { | ||
| 24 | if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): | ||
| 25 | d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1") | ||
| 26 | } | ||
| 27 | |||
| 28 | inherit update-rc.d | ||
| 29 | |||
| 30 | INITSCRIPT_NAME = "alsa-state" | ||
| 31 | INITSCRIPT_PARAMS = "start 39 S . stop 31 0 6 ." | ||
| 32 | |||
| 33 | do_install() { | ||
| 34 | # Only install the init script when 'sysvinit' is in DISTRO_FEATURES. | ||
| 35 | if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then | ||
| 36 | sed -i -e "s:#STATEDIR#:${localstatedir}/lib/alsa:g" ${WORKDIR}/alsa-state-init | ||
| 37 | install -d ${D}${sysconfdir}/init.d | ||
| 38 | install -m 0755 ${WORKDIR}/alsa-state-init ${D}${sysconfdir}/init.d/alsa-state | ||
| 39 | fi | ||
| 40 | |||
| 41 | install -d ${D}/${localstatedir}/lib/alsa | ||
| 42 | install -d ${D}${sysconfdir} | ||
| 43 | install -m 0644 ${WORKDIR}/asound.conf ${D}${sysconfdir} | ||
| 44 | install -m 0644 ${WORKDIR}/*.state ${D}${localstatedir}/lib/alsa | ||
| 45 | } | ||
| 46 | |||
| 47 | PACKAGES += "alsa-states" | ||
| 48 | |||
| 49 | RRECOMMENDS_alsa-state = "alsa-states" | ||
| 50 | |||
| 51 | RDEPENDS_${PN} = "alsa-utils-alsactl" | ||
| 52 | FILES_${PN} = "${sysconfdir}/init.d ${sysconfdir}/asound.conf" | ||
| 53 | CONFFILES_${PN} = "${sysconfdir}/asound.conf" | ||
| 54 | |||
| 55 | FILES_alsa-states = "${localstatedir}/lib/alsa/*.state" | ||
| 56 | |||
| 57 | pkg_postinst_${PN}() { | ||
| 58 | if test -z "$D" | ||
| 59 | then | ||
| 60 | if test -x ${sbindir}/alsactl | ||
| 61 | then | ||
| 62 | ${sbindir}/alsactl -f ${localstatedir}/lib/alsa/asound.state restore | ||
| 63 | fi | ||
| 64 | fi | ||
| 65 | } | ||
diff --git a/meta/recipes-bsp/alsa-state/alsa-state/alsa-state-init b/meta/recipes-bsp/alsa-state/alsa-state/alsa-state-init new file mode 100755 index 0000000000..eee59cb321 --- /dev/null +++ b/meta/recipes-bsp/alsa-state/alsa-state/alsa-state-init | |||
| @@ -0,0 +1,39 @@ | |||
| 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 | # source function library | ||
| 10 | . /etc/init.d/functions | ||
| 11 | |||
| 12 | asound_restore(){ | ||
| 13 | echo "ALSA: Restoring mixer settings..." | ||
| 14 | if test -x /usr/sbin/alsactl -a -e #STATEDIR#/asound.state | ||
| 15 | then | ||
| 16 | /usr/sbin/alsactl -f #STATEDIR#/asound.state restore & | ||
| 17 | fi | ||
| 18 | } | ||
| 19 | |||
| 20 | asound_store(){ | ||
| 21 | echo "ALSA: Storing mixer settings..." | ||
| 22 | if test -x /usr/sbin/alsactl | ||
| 23 | then | ||
| 24 | /usr/sbin/alsactl -f #STATEDIR#/asound.state store | ||
| 25 | fi | ||
| 26 | } | ||
| 27 | |||
| 28 | case "$1" in | ||
| 29 | start) asound_restore ;; | ||
| 30 | stop) asound_store ;; | ||
| 31 | status) | ||
| 32 | status /usr/sbin/alsactl; | ||
| 33 | exit $? | ||
| 34 | ;; | ||
| 35 | *) | ||
| 36 | echo "Usage: /etc/init.d/alsa-state {start|stop|status}" | ||
| 37 | exit 1 | ||
| 38 | ;; | ||
| 39 | 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..03653cfb2d --- /dev/null +++ b/meta/recipes-bsp/alsa-state/alsa-state/asound.conf | |||
| @@ -0,0 +1 @@ | |||
| # Global alsa-lib configuration | |||
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 | |||
