Add alsa-state from OE Classic
cover Add alsa-state from OE Classic
Please review the following changes for suitability for inclusion. If you have any objections or suggestions for improvement, please respond to the patches. If you agree with the changes, please provide your Acked-by.
The small series following introduces the alsa-state recipe from oe-classic. The reason for doing so is to remove the requirement for recipes like the beagleboard-audio recipe in meta-yocto, which ensures the beagleboards sound device has the volume turned up.
Long term I'd like to implement something more generic for handling device quirks, but alsa-state is a simple fix for an immediate need that should standardise how alsa configuration is handled in layers.
Cheers.
Joshua
The following changes since commit 8f348ccad083d6c02c200652ff6295e701e88f0d:
coreutils: ensure --color works so DEPEND on libcap (2011-12-24 10:05:35 +0000)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib josh/devices
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=josh/devices
Joshua Lock (2):
alsa-state: add alsa-state from oe classic
task-base: add alsa-state to task-base-alsa
meta/recipes-bsp/alsa-state/alsa-state.bb | 57 ++++++++++++++++++++ meta/recipes-bsp/alsa-state/alsa-state/alsa-state | 29 ++++++++++ meta/recipes-bsp/alsa-state/alsa-state/asound.conf | 12 ++++ .../recipes-bsp/alsa-state/alsa-state/asound.state | 1 + meta/recipes-core/tasks/task-base.bb | 5 +- 5 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 meta/recipes-bsp/alsa-state/alsa-state.bb create mode 100755 meta/recipes-bsp/alsa-state/alsa-state/alsa-state create mode 100644 meta/recipes-bsp/alsa-state/alsa-state/asound.conf create mode 100644 meta/recipes-bsp/alsa-state/alsa-state/asound.state
Signature · 1 line
1.7.7.4
RFC PATCH 1/2 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.
--- meta/recipes-bsp/alsa-state/alsa-state.bb | 57 ++++++++++++++++++++ meta/recipes-bsp/alsa-state/alsa-state/alsa-state | 29 ++++++++++ meta/recipes-bsp/alsa-state/alsa-state/asound.conf | 12 ++++ .../recipes-bsp/alsa-state/alsa-state/asound.state | 1 + 4 files changed, 99 insertions(+), 0 deletions(-) create mode 100644 meta/recipes-bsp/alsa-state/alsa-state.bb create mode 100755 meta/recipes-bsp/alsa-state/alsa-state/alsa-state create mode 100644 meta/recipes-bsp/alsa-state/alsa-state/asound.conf create mode 100644 meta/recipes-bsp/alsa-state/alsa-state/asound.state
meta/recipes-bsp/alsa-state/alsa-state.bb new file +57 -0
@@ -0,0 +1,57 @@ +# Copyright Matthias Hentges <[email protected]> (c) 2007 +# License: MIT (see http://www.opensource.org/licenses/mit-license.php +# for a copy of the license) +# +# Filename: alsa-state.bb + +SUMMARY = "Alsa scenario files to enable alsa state restoration." +DESCRIPTION = "Alsa Scenario Files - an init script and state files to restore \ +sound state at system boot and save it at system shut down." +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" +PV = "0.2.0" +PR = "r0" + +SRC_URI = "\ + file://asound.conf \ + file://asound.state \ + file://alsa-state \ +" + +RDEPENDS = "alsa-utils-alsactl" + +inherit update-rc.d + +INITSCRIPT_NAME = "alsa-state" +INITSCRIPT_PARAMS = "start 39 S . stop 31 0 6 ." + +do_install() { + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/alsa-state ${D}${sysconfdir}/init.d + + install -m 0644 ${WORKDIR}/asound.conf ${D}${sysconfdir} + install -m 0644 ${WORKDIR}/*.state ${D}${sysconfdir} +} + +PACKAGES += "alsa-states" + +RRECOMMENDS_alsa-state = "alsa-states" + +FILES_${PN} = "${sysconfdir}/init.d ${sysconfdir}/asound.conf" +CONFFILES_${PN} = "${sysconfdir}/asound.conf" + +FILES_alsa-states = "${sysconfdir}/*.state" + +pkg_postinst_${PN}() { + if test -z "$D" + then + if test -x /usr/sbin/alsactl + then + /usr/sbin/alsactl -f ${sysconfdir}/asound.state restore + fi + # INITSCRIPT_PARAMS changed, so remove the old and + # install the new setting. + update-rc.d -f ${INITSCRIPT_NAME} remove + update-rc.d ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS} + fi +}
meta/recipes-bsp/alsa-state/alsa-state/alsa-state new file +29 -0
@@ -0,0 +1,29 @@ +#! /bin/sh +# +# Copyright Matthias Hentges <[email protected]> (c) 2007 +# License: GPL (see http://www.gnu.org/licenses/gpl.txt for a copy of the license) +# +# Filename: alsa-state +# Date: 20070308 (YMD) + + +asound_restore(){ + echo "ALSA: Restoring mixer settings..." + if test -x /usr/sbin/alsactl -a -e /etc/asound.state + then + /usr/sbin/alsactl -f /etc/asound.state restore & + fi +} + +asound_store(){ + echo "ALSA: Storing mixer settings..." + if test -x /usr/sbin/alsactl + then + /usr/sbin/alsactl -f /etc/asound.state store + fi +} + +case "$1" in +start) asound_restore ;; +stop) asound_store ;; +esac
meta/recipes-bsp/alsa-state/alsa-state/asound.conf new file +12 -0
@@ -0,0 +1,12 @@ +# default dmix configuration + +pcm.!default { + type plug + slave.pcm "dmix" +} + +ctl.mixer0 { + type hw + card 0 +} +
meta/recipes-bsp/alsa-state/alsa-state/asound.state new file +1 -0
@@ -0,0 +1 @@ +# Dummy file, do not delete
Signature · 1 line
1.7.7.4
RFC PATCH 2/2 task-base: add alsa-state to task-base-alsa
In reply to Joshua LockThis enables automatic configuration setting and restoration on systems with alsa.
--- meta/recipes-core/tasks/task-base.bb | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
meta/recipes-core/tasks/task-base.bb +3 -2
@@ -2,7 +2,7 @@ DESCRIPTION = "Merge machine and distro options to create a basic machine task/p LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \ file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" -PR = "r72" +PR = "r73" inherit task
@@ -183,7 +183,8 @@ RRECOMMENDS_task-base-vfat = "\ RDEPENDS_task-base-alsa = "\ alsa-utils-alsactl \ - alsa-utils-alsamixer" + alsa-utils-alsamixer \ + alsa-state" RRECOMMENDS_task-base-alsa = "\ kernel-module-snd-mixer-oss \
Signature · 1 line
1.7.7.4
Quoted 4 lines · Joshua Lock
Please review the following changes for suitability for inclusion. If you have any objections or suggestions for improvement, please respond to the patches. If you agree with the changes, please provide your Acked-by.
Quoted 9 lines
The small series following introduces the alsa-state recipe from oe-classic. The reason for doing so is to remove the requirement for recipes like the beagleboard-audio recipe in meta-yocto, which ensures the beagleboards sound device has the volume turned up.
Long term I'd like to implement something more generic for handling device quirks, but alsa-state is a simple fix for an immediate need that should standardise how alsa configuration is handled in layers.
Will this address the similar issue that the n450-audio recipe does in the meta-intel layer? The n450 seems to use amixer and not alsactl.
And if so, can you provide a patch for meta-intel?
Sau!
Quoted 26 lines
Cheers.
JoshuaThe following changes since commit
8f348ccad083d6c02c200652ff6295e701e88f0d:coreutils: ensure --color works so DEPEND on libcap (2011-12-24 10:05:35 +0000)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contribjosh/devices
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=josh/devicesJoshua Lock (2):
alsa-state: add alsa-state from oe classic
task-base: add alsa-state to task-base-alsameta/recipes-bsp/alsa-state/alsa-state.bb | 57 ++++++++++++++++++++ meta/recipes-bsp/alsa-state/alsa-state/alsa-state | 29 ++++++++++ meta/recipes-bsp/alsa-state/alsa-state/asound.conf | 12 ++++ .../recipes-bsp/alsa-state/alsa-state/asound.state | 1 + meta/recipes-core/tasks/task-base.bb | 5 +- 5 files changed, 102 insertions(+), 2 deletions(-)create mode 100644 meta/recipes-bsp/alsa-state/alsa-state.bb create mode 100755 meta/recipes-bsp/alsa-state/alsa-state/alsa-state create mode 100644
meta/recipes-bsp/alsa-state/alsa-state/asound.confcreate mode 100644 meta/recipes-bsp/alsa-state/alsa-state/asound.state
Quoted 14 lines · Saul Wold
Quoted 13 lines · Joshua Lock
Please review the following changes for suitability for inclusion. If you have
any objections or suggestions for improvement, please respond to the patches. If
you agree with the changes, please provide your Acked-by.The small series following introduces the alsa-state recipe from oe-classic.
The reason for doing so is to remove the requirement for recipes like the beagleboard-audio recipe in meta-yocto, which ensures the beagleboards sound
device has the volume turned up.
Quoted 8 lines
Quoted 6 lines
Long term I'd like to implement something more generic for handling device quirks,
but alsa-state is a simple fix for an immediate need that should standardise how
alsa configuration is handled in layers.Will this address the similar issue that the n450-audio recipe does in the meta-intel layer? The n450 seems to use amixer and not alsactl.
That's the intent. The beagleboard-audio recipe in meta-yocto also uses amixer not alsactl but alsactl and the alsa-state recipe offers more functionality IMHO (and fewer dependencies iirc).
Quoted 2 lines
And if so, can you provide a patch for meta-intel?
Can do, I've already got one for meta-yocto prepared but was waiting for some C's before submitting.
Joshua
Signature · 3 lines
Joshua Lock
Yocto Project "Johannes factotum"
Intel Open Source Technology Centre