main/alsa-utils: further improves to card number extraction regex

On systems where the soundcard longname also contains digits, the
regex added in !87552 could also match that longname.

All of these issues starting surfacing now because with release
1.2.14, alsactl has gotten more strict about situations where
passed sound devices are not available in kernel.

For an exact description of the file format refer to:

* https://www.alsa-project.org/alsa-doc/alsa-lib/control.html
* https://github.com/torvalds/linux/blob/v6.12/sound/core/init.c#L943-L949
This commit is contained in:
Sören Tempel 2025-07-23 11:47:48 +02:00 committed by Natanael Copa
parent 45ce9d5b48
commit 299dfd748c
2 changed files with 6 additions and 3 deletions

View File

@ -2,7 +2,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=alsa-utils
pkgver=1.2.14
pkgrel=1
pkgrel=2
pkgdesc="Advanced Linux Sound Architecture (ALSA) utilities"
url="https://alsa-project.org/"
arch="all"
@ -49,7 +49,7 @@ alsaconf() {
sha512sums="
dd470a2f5210822cc4d3ded094b84721a07904df5c32dd329e0cb4c052d39e3e6d7ddb511cde2d23b3f6824c71fba9dbdca369355d5c03b234e989dbbb9b7a95 alsa-utils-1.2.14.tar.bz2
f04155e1e391c7f36d44422c8e769bf9370117f6bbea6c0664e9858f7a676cc958e4260e4b4d226e71d0716f6be4e6fdd60f1d07cb7e9922fff378ceec01c47d alsaconf.patch
5bd5a55c137a6a33b7d2ac59cc29c1b539708dddf6448d572ffa85458c9d8cb7563b661cdf5d5755985b1e45e03c77eae403a4085f4be87a0af9d3865e70f7b8 alsa.initd
fc15e01de6b96d7e257d9c19fe8894bf090b6c0366beb9513e11ad6657b6c8d47530d9c1afc545aedf154f16000fd2f637e0104a2ec993e651fd4db419acb9af alsa.initd
d7e212e9f624b09168117b46c66289204a23915adf0d1b0c9ae258049430397b8f2d86d3b5f7e3087151948a031c4eab863e8195a6c7b1276704e9cba9c2d2a7 alsa.confd
4b4b4d6406d57f592ecec9a79b5e401d1e1025e4f0b0d51ba233a5d2fcd1ce27ef336fda0242e7ff7d229d00428b7030d1d5789c9c306f824938366530eff6d9 musl-locale.patch
ee74137d5bf431090a2603c87c94f19063d9a62921b3c6bc1f19317e006a7ec278b66da9ccfb1b64fa5da46852f6a84ac2511b9ce74969799d0fca4cd9b2bc8d musl-types.patch

View File

@ -27,7 +27,10 @@ restore() {
return 0
fi
local cards="$(sed -n -e 's/ *\([[:digit:]][[:digit:]]*\) .*/\1/p' /proc/asound/cards)"
# The regex extracts the card numbers from /proc/asound/cards, see:
# * https://www.alsa-project.org/alsa-doc/alsa-lib/control.html
# * https://github.com/torvalds/linux/blob/v6.12/sound/core/init.c#L943-L949
local cards="$(sed -E -n 's/^ ?([[:digit:]]+).*/\1/p' /proc/asound/cards)"
local cardnum
for cardnum in ${cards}; do
[ -e /dev/snd/controlC${cardnum} ] || sleep 2